more work on case
This commit is contained in:
36
src/Lib/Util.idr
Normal file
36
src/Lib/Util.idr
Normal file
@@ -0,0 +1,36 @@
|
||||
module Lib.Util
|
||||
|
||||
import Lib.Types
|
||||
|
||||
export
|
||||
funArgs : Tm -> (Tm, List Tm)
|
||||
funArgs tm = go tm []
|
||||
where
|
||||
go : Tm -> List Tm -> (Tm, List Tm)
|
||||
go (App _ t u) args = go t (u :: args)
|
||||
go t args = (t, args)
|
||||
|
||||
|
||||
public export
|
||||
data Binder : Type where
|
||||
MkBind : FC -> String -> Icit -> Tm -> Binder
|
||||
|
||||
-- I don't have a show for terms without a name list
|
||||
export
|
||||
Show Binder where
|
||||
show (MkBind _ nm icit t) = "[\{nm} \{show icit} : ...]"
|
||||
|
||||
data Foo : Type -> Type where
|
||||
MkFoo : Nat -> Foo a
|
||||
|
||||
export
|
||||
splitTele : Tm -> (Tm, List Binder)
|
||||
splitTele = go []
|
||||
where
|
||||
go : List Binder -> Tm -> (Tm, List Binder)
|
||||
go ts (Pi fc nm icit t u) = go (MkBind fc nm icit t :: ts) u
|
||||
go ts tm = (tm, reverse ts)
|
||||
|
||||
|
||||
-- splitTele (Pi x str icit t u) = ?splitTele_rhs_6
|
||||
-- splitTele tm =
|
||||
Reference in New Issue
Block a user