Created
June 4, 2020 17:53
-
-
Save inariksit/88281c9698fd45a5f2bd00aaf14fa183 to your computer and use it in GitHub Desktop.
GF grammar to see new error msgs to common errors
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
abstract Errors = { | |
cat S ; A ; | |
fun | |
thisWorks : S ; | |
patternMatchingRuntime : A -> S ; | |
unsupportedTokenGluing : A -> S ; | |
nonexhaustivePattern : A ; | |
tooFewArgs, tooManyArgs : A ; | |
} |
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
concrete ErrorsCnc of Errors = open Prelude in { | |
lincat S, A = SS ; | |
lin | |
thisWorks = ss "no errors here" ; | |
-- nonexhaustivePattern = mkSS "foox" ; | |
-- unsupportedTokenGluing a = ss (a.s + "illegal") ; | |
-- tooManyArgs = mkSS2 "too" "many" "args" ; | |
-- tooFewArgs = mkSS2 "toofew" ; | |
-- patternMatchingRuntime a = ss (case a.s of {"foo" => "bar"}) ; | |
oper | |
mkSS : Str -> SS = \str -> | |
case str of { | |
x + "foo" => ss (x + "bar") | |
} ; | |
mkSS2 : Str -> Str -> SS = \str,dummy -> ss str ; | |
-- mkSSTooManyInTypeSignature : Str -> Str -> SS = \x -> ss x ; | |
-- mkSSTooFewInTypeSignature : Str -> SS = \x,y -> ss x ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment