-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3a7a76
commit d280fe7
Showing
6 changed files
with
78 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
module Juvix.Compiler.Builtins.Eq where | ||
|
||
import Juvix.Compiler.Internal.Builtins | ||
import Juvix.Compiler.Internal.Extra | ||
import Juvix.Prelude | ||
import Juvix.Prelude.Pretty | ||
|
||
checkEqDef :: InductiveDef -> Sem r () | ||
checkEqDef _ = return () | ||
checkEqDef :: forall r. (Members '[Reader BuiltinsTable, Error ScoperError] r) => InductiveDef -> Sem r () | ||
checkEqDef d = do | ||
let err :: forall a. Text -> Sem r a | ||
err = builtinsErrorText (getLoc d) | ||
unless (isSmallUniverse' (d ^. inductiveType)) (err "Lists should be in the small universe") | ||
let eqTxt = prettyText BuiltinEq | ||
case d ^. inductiveParameters of | ||
[_] -> return () | ||
_ -> err (eqTxt <> "should have exactly one type parameter") | ||
case d ^. inductiveConstructors of | ||
[c1] -> checkMkEq c1 | ||
_ -> err (eqTxt <> "should have exactly two constructors") | ||
|
||
checkMkEq :: ConstructorDef -> Sem r () | ||
checkMkEq _ = return () | ||
|
||
checkIsEq :: FunctionDef -> Sem r () | ||
checkIsEq _ = return () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters