Skip to content

Instantly share code, notes, and snippets.

@m0ar
Created April 9, 2018 08:24
Show Gist options
  • Save m0ar/d6f4143a62fca0dcd29efd38c67c6260 to your computer and use it in GitHub Desktop.
Save m0ar/d6f4143a62fca0dcd29efd38c67c6260 to your computer and use it in GitHub Desktop.
Would like to do something like this in the parser
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