Created
April 9, 2018 08:24
-
-
Save m0ar/d6f4143a62fca0dcd29efd38c67c6260 to your computer and use it in GitHub Desktop.
Would like to do something like this in the parser
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
maybeweight :: { Maybe Weight } | |
: {- empty -} { Nothing } | |
| '{-# WEIGHT' INTEGER '#-}' { Just (Weight $ getINTEGER $2) | |
{- Error: | |
compiler/stage1/build/Parser.hs:9945:34: error: | |
• Couldn't match expected type ‘Integer’ | |
with actual type ‘IntegralLit’ | |
• In the second argument of ‘($)’, namely ‘getINTEGER happy_var_2’ | |
In the first argument of ‘Just’, namely | |
‘(Weight $ getINTEGER happy_var_2)’ | |
In the first argument of ‘happyIn249’, namely | |
‘(Just (Weight $ getINTEGER happy_var_2))’ | |
| | |
9945 | (Just (Weight $ getINTEGER happy_var_2) | |
| ^^^^^^^^^^^^^^^^^^^^^^ | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment