porting WIP

This commit is contained in:
2025-01-01 20:24:53 -08:00
parent 9ed2b2077d
commit e41e1d8f6a
24 changed files with 2118 additions and 16 deletions

26
done/Lib/Util.newt Normal file
View File

@@ -0,0 +1,26 @@
module Lib.Util
import Lib.Types
funArgs : Tm -> (Tm × List Tm)
funArgs tm = go tm Nil
where
go : Tm -> List Tm -> (Tm × List Tm)
go (App _ t u) args = go t (u :: args)
go t args = (t, args)
data Binder : U where
MkBind : FC -> String -> Icit -> Quant -> Tm -> Binder
-- I don't have a show for terms without a name list
instance Show Binder where
show (MkBind _ nm icit quant t) = "(\{show quant}\{nm} \{show icit} : ... :: Nil)"
splitTele : Tm -> (Tm × List Binder)
splitTele = go Nil
where
go : List Binder -> Tm -> (Tm × List Binder)
go ts (Pi fc nm icit quant t u) = go (MkBind fc nm icit quant t :: ts) u
go ts tm = (tm, reverse ts)