Checkpoint some existing changes.
This commit is contained in:
115
src/Syntax.idr
115
src/Syntax.idr
@@ -3,7 +3,6 @@ module Syntax
|
||||
import Data.String
|
||||
import Derive
|
||||
|
||||
|
||||
-- Good enough start, lets parse
|
||||
-- This is informed by pi-forall and others and is somewhat low level
|
||||
-- %language ElabReflection
|
||||
@@ -64,6 +63,7 @@ public export
|
||||
data Decl
|
||||
= TypeSig Name TyTerm
|
||||
| Def Name Term
|
||||
| DImport Name
|
||||
| Data Name Telescope (List ConstrDef)
|
||||
|
||||
public export
|
||||
@@ -76,55 +76,68 @@ record Module where
|
||||
foo : List String -> String
|
||||
foo ts = "(" ++ unwords ts ++ ")"
|
||||
|
||||
mutual
|
||||
Show ConstrDef where
|
||||
show x = ?holex
|
||||
|
||||
covering
|
||||
Show Decl where
|
||||
show (TypeSig str x) = foo ["TypeSig", show str, show x]
|
||||
show (Def str x) = foo ["Def", show str, show x]
|
||||
show (Data str xs ys) = foo ["Data", show str, show xs, show ys]
|
||||
Show Literal where
|
||||
show (LString str) = foo [ "LString", show str]
|
||||
show (LInt i) = foo [ "LInt", show i]
|
||||
show (LBool x) = foo [ "LBool", show x]
|
||||
|
||||
|
||||
export
|
||||
covering
|
||||
implementation Show Term
|
||||
|
||||
export
|
||||
implementation Show Decl
|
||||
|
||||
covering
|
||||
Show ConstrDef where
|
||||
show (MkCDef str xs) = foo ["MkCDef", show str, show xs]
|
||||
|
||||
|
||||
covering
|
||||
Show Decl where
|
||||
show (TypeSig str x) = foo ["TypeSig", show str, show x]
|
||||
show (Def str x) = foo ["Def", show str, show x]
|
||||
show (Data str xs ys) = foo ["Data", show str, show xs, show ys]
|
||||
show (DImport str) = foo ["DImport", show str]
|
||||
|
||||
|
||||
export covering
|
||||
Show Module where
|
||||
show (MkModule name imports decls) = foo ["MkModule", show name, show imports, show decls]
|
||||
|
||||
Show RigCount where
|
||||
show Rig0 = "Rig0"
|
||||
show RigW = "RigW"
|
||||
|
||||
Show Pattern where
|
||||
show (PatVar str) = foo ["PatVar", show str]
|
||||
show (PatCon str xs) = foo ["PatCon", show str, assert_total $ show xs]
|
||||
show PatWild = "PatWild"
|
||||
show (PatLit x) = foo ["PatLit" , show x]
|
||||
|
||||
Show CaseAlt where
|
||||
show (MkAlt x y)= foo ["MkAlt", show x, assert_total $ show y]
|
||||
|
||||
Show Plicity where
|
||||
show Implicit = "Implicit"
|
||||
show Explicit = "Explicit"
|
||||
show Eq = "Eq"
|
||||
|
||||
covering
|
||||
Show Term where
|
||||
show (Ann t ty) = "Ann" ++ " " ++ show t ++ " " ++ show ty
|
||||
show Wildcard = "Wildcard"
|
||||
|
||||
export covering
|
||||
Show Module where
|
||||
show (MkModule name imports decls) = foo ["MkModule", show name, show imports, show decls]
|
||||
|
||||
Show RigCount where
|
||||
show Rig0 = "Rig0"
|
||||
show RigW = "RigW"
|
||||
|
||||
Show Pattern where
|
||||
show (PatVar str) = foo ["PatVar", show str]
|
||||
show (PatCon str xs) = foo ["PatCon", show str, assert_total $ show xs]
|
||||
show PatWild = "PatWild"
|
||||
show (PatLit x) = foo ["PatLit" , show x]
|
||||
|
||||
|
||||
Show CaseAlt where
|
||||
show (MkAlt x y)= foo ["MkAlt", show x, assert_total $ show y]
|
||||
|
||||
Show Plicity where
|
||||
show Implicit = "Implicit"
|
||||
show Explicit = "Explicit"
|
||||
show Eq = "Eq"
|
||||
|
||||
Show Literal where
|
||||
show (LString str) = foo [ "LString", show str]
|
||||
show (LInt i) = foo [ "LInt", show i]
|
||||
show (LBool x) = foo [ "LBool", show x]
|
||||
|
||||
|
||||
export
|
||||
Show Term where
|
||||
show (Var name) = foo ["Var", show name]
|
||||
show (Ann t ty) = foo [ "Ann", show t, show ty]
|
||||
show (Lit x) = foo [ "Lit", show x]
|
||||
show (Let alts y) = foo [ "Let", assert_total $ show alts, show y]
|
||||
show (Pi str x y z) = foo [ "Pi", show str, show x, show y, show z]
|
||||
show (App x y) = foo [ "App", show x, show y]
|
||||
show (Lam x y) = foo [ "Lam", show x, show y]
|
||||
show (Case x xs) = foo [ "Case", show x, show xs]
|
||||
show Wildcard = "Wildcard"
|
||||
show (ParseError str) = foo [ "ParseError", "str"]
|
||||
|
||||
show (Var name) = foo ["Var", show name]
|
||||
show (Ann t ty) = foo [ "Ann", show t, show ty]
|
||||
show (Lit x) = foo [ "Lit", show x]
|
||||
show (Let alts y) = foo [ "Let", show alts, show y]
|
||||
show (Pi str x y z) = foo [ "Pi", show str, show x, show y, show z]
|
||||
show (App x y) = foo [ "App", show x, show y]
|
||||
show (Lam x y) = foo [ "Lam", show x, show y]
|
||||
show (Case x xs) = foo [ "Case", show x, show xs]
|
||||
|
||||
show (ParseError str) = foo [ "ParseError", "str"]
|
||||
show _ = "woo"
|
||||
|
||||
Reference in New Issue
Block a user