<div dir="ltr"><div><div style>I'm having the following issue but I have no idea what to do about it, clearly I'm missing something.</div><div><br></div><div>integer = P.integer lexer</div></div><div style>identifier = P.identifier lexer</div>
<div style><br></div><div>data Expression = ID String</div><div> | Num Integer </div><div><span class="" style="white-space:pre">                        </span> deriving (Show)</div><div><br></div><div>name :: Expression</div><div>
name = ID "string"</div><div><br></div><div>number :: Expression</div><div>number = Num 123</div><div style><br></div><div>whileParser :: Parser Expression</div><div>whileParser = whiteSpace >> expr8</div>
<div><br></div><div>expr8 :: Parser Expression<span class="" style="white-space:pre">        </span></div><div>expr8 = name </div><div><span class="" style="white-space:pre">        </span><|> number</div><div><br></div><div style>
The error I'm getting is the following:</div><div style><div><br></div><div>Couldn't match expected type `Text.Parsec.Prim.ParsecT</div><div> String () Data.Functor.Identity.Identity Expression'</div>
<div> with actual type `Expression'</div><div> In the first argument of `(<|>)', namely `name'</div><div> In the expression: name <|> number</div><div> In an equation for `expr8': expr8 = name <|> number</div>
<div>Failed, modules loaded: none.</div><div><br></div><div style>Also there is an issue where i have the following code changed:</div><div style>name = ID "string"</div><div style>to</div><div style>name = ID identifier</div>
<div><div><br></div><div>number = Num 123</div><div>to </div><div>number = Num integer</div></div><div><br></div><div style>which gives me two further errors regarding:</div><div style><div>Couldn't match expected type `String'</div>
<div> with actual type `Text.Parsec.Prim.ParsecT</div><div> String () Data.Functor.Identity.Identity String'</div><div><br></div></div><div style>and</div><div style><div>
<br></div><div>Couldn't match expected type `Integer'</div><div> with actual type `Text.Parsec.Prim.ParsecT</div><div> String () Data.Functor.Identity.Identity Integer'</div>
<div><br></div></div><div style>Now I am sure this is something silly but thanks for any help!</div><div style><br></div></div></div>