How to parse string into GADT
问题 I am trying trying to implement Combinatory Logic in Haskell, and I would like to write to parser for the language. I am having trouble getting a parser to work via Parsec. The basic problem is that I need a way to ensure that the objects returned by the parser are well typed. Does anyone have any creative ideas on how to do this? {-# Language GeneralizedNewtypeDeriving #-} import qualified Data.Map as Map import qualified Text.ParserCombinators.Parsec as P import Text.Parsec.Token (parens)