Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update elab for WithFC #109

Merged
merged 1 commit into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Idrall/Derive.idr
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ deriveFromDhall it {options} n =

clauses <- genClauses it funName argName cons

let funClaim = IClaim EmptyFC MW Export [Inline] (MkTy EmptyFC EmptyFC funName `(Expr Void -> Either Error ~(var name)))
let funClaim = IClaim $ MkFCVal EmptyFC $ MkIClaimData MW Export [Inline] (MkTy EmptyFC (NoFC funName) `(Expr Void -> Either Error ~(var name)))
-- add a catch all pattern
let funDecl = IDef EmptyFC funName (clauses ++ [patClause `(~(var funName) ~(varStr "expr")) `(Left $ FromDhallError (getFC ~(varStr "expr")) "\{show expr}")])

Expand All @@ -110,7 +110,7 @@ deriveFromDhall it {options} n =

-- created interface for Example, and use function we already declared
let retty = `(FromDhall ~(var name))
let objClaim = IClaim EmptyFC MW Export [Hint True, Inline] (MkTy EmptyFC EmptyFC objName retty)
let objClaim = IClaim $ MkFCVal EmptyFC $ MkIClaimData MW Export [Hint True, Inline] (MkTy EmptyFC (NoFC objName) retty)
let objrhs = `(~(var ifCon) ~(var funName))
let objDecl = IDef EmptyFC objName [(PatClause EmptyFC (var objName) objrhs)]
declare [objClaim, objDecl]
Expand Down
2 changes: 1 addition & 1 deletion Idrall/Derive/Common.idr
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import public Data.String
||| This is an alias for `MkTyp EmptyFC`.
export
mkTy : (n : Name) -> (ty : TTImp) -> ITy
mkTy = MkTy EmptyFC EmptyFC
mkTy = MkTy EmptyFC . MkFCVal EmptyFC

||| Creates a variable from the given name
|||
Expand Down
8 changes: 4 additions & 4 deletions Idrall/Derive/ToDhall.idr
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,12 @@ toDhallImpl typeName =
toDhallLitClause = patClause toDhall $ var rhsToDhallLit

impl = ILocal EmptyFC
[ IClaim EmptyFC MW Private [] (MkTy EmptyFC EmptyFC toDhallName `(~(typeNameImp) -> Expr Void))
[ IClaim $ NoFC $ MkIClaimData MW Private [] (MkTy EmptyFC (NoFC toDhallName) `(~(typeNameImp) -> Expr Void))
, IDef EmptyFC toDhallName [toDhallLitClause]
]
`(~(var mkToDhall) ~(var rhsToDhallType) ~(var rhsToDhallLit))

in [ IClaim EmptyFC MW Public [Hint True] $ MkTy EmptyFC EmptyFC functionName `(ToDhall ~(typeNameImp))
in [ IClaim $ NoFC $ MkIClaimData MW Public [Hint True] $ MkTy EmptyFC (NoFC functionName) `(ToDhall ~(typeNameImp))
, IDef EmptyFC functionName [patClause function impl]
]

Expand Down Expand Up @@ -222,8 +222,8 @@ deriveToDhall it {options} n = do
-- logCons cons

-- create the function type signatures
let funClaimType = IClaim EmptyFC MW Export [Inline] (MkTy EmptyFC EmptyFC funNameType `(Expr Void))
let funClaimLit = IClaim EmptyFC MW Export [Inline] (MkTy EmptyFC EmptyFC funNameLit `(~(var name) -> Expr Void))
let funClaimType = IClaim $ NoFC $ MkIClaimData MW Export [Inline] (MkTy EmptyFC (NoFC funNameType) `(Expr Void))
let funClaimLit = IClaim $ NoFC $ MkIClaimData MW Export [Inline] (MkTy EmptyFC (NoFC funNameLit) `(~(var name) -> Expr Void))

-- declare the function type signatures in the env
declare [funClaimType, funClaimLit]
Expand Down
Loading