Skip to content

Instantly share code, notes, and snippets.

@laser
Last active August 29, 2015 14:02
Show Gist options
  • Save laser/12b32337da74f9c7973a to your computer and use it in GitHub Desktop.
Save laser/12b32337da74f9c7973a to your computer and use it in GitHub Desktop.
cryptic error message
*Cis194.Hw.SExpr> :r
[2 of 2] Compiling Cis194.Hw.SExpr ( src/Cis194/Hw/SExpr.hs, interpreted )
src/Cis194/Hw/SExpr.hs:84:38:
Couldn't match type `SExpr' with `Atom'
Expected type: [SExpr] -> Atom
Actual type: [SExpr] -> SExpr
In the first argument of `pure', namely `(Comb)'
In the first argument of `(<*>)', namely `pure (Comb)'
In the second argument of `(<|>)', namely
`(pure (Comb) <*> (char '(' *> some parseSExpr <* char ')'))'
Failed, modules loaded: Cis194.Hw.AParser.
*Cis194.Hw.AParser>
parseAtom :: Parser Atom
parseAtom = (pure (N) <*> posInt) <|> (pure (I) <*> ident)
parseSExpr :: Parser SExpr
parseSExpr = spaces *> parse <* spaces
where parse = parseAtom <|> (pure (Comb) <*> (char '(' *> some parseSExpr <* char ')'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment