<div dir="ltr"><div><div style>I&#39;m having the following issue but I have no idea what to do about it, clearly I&#39;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 &quot;string&quot;</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 &gt;&gt; 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>&lt;|&gt; number</div><div><br></div><div style>
The error I&#39;m getting is the following:</div><div style><div><br></div><div>Couldn&#39;t match expected type `Text.Parsec.Prim.ParsecT</div><div>                                    String () Data.Functor.Identity.Identity Expression&#39;</div>
<div>                with actual type `Expression&#39;</div><div>    In the first argument of `(&lt;|&gt;)&#39;, namely `name&#39;</div><div>    In the expression: name &lt;|&gt; number</div><div>    In an equation for `expr8&#39;: expr8 = name &lt;|&gt; 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 &quot;string&quot;</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&#39;t match expected type `String&#39;</div>
<div>                with actual type `Text.Parsec.Prim.ParsecT</div><div>                                    String () Data.Functor.Identity.Identity String&#39;</div><div><br></div></div><div style>and</div><div style><div>
<br></div><div>Couldn&#39;t match expected type `Integer&#39;</div><div>                with actual type `Text.Parsec.Prim.ParsecT</div><div>                                    String () Data.Functor.Identity.Identity Integer&#39;</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>