[Haskell-beginners] [Haskell-cafe] parser error in pattern

kolli kolli nammukolli04 at gmail.com
Tue Oct 18 00:08:42 CEST 2011


actual error message is

homework2.lhs:137:20: parse error on input `where'

data Term = Tru
          | Fls
          | If Term Term Term
          | Zero
          | Succ Term
          | Pred Term
          | IsZero Term
          deriving Eq





On Mon, Oct 17, 2011 at 4:03 PM, Ivan Lazar Miljenovic <
ivan.miljenovic at gmail.com> wrote:

> On 18 October 2011 08:56, kolli kolli <nammukolli04 at gmail.com> wrote:
> > after parsing a string i am evaluating it...
> > string if t1 then t2 else t3
> > my code is
> > eval1 :: Term ->  Maybe Term
> > eval1(If Tru t2 t3) = Just t2
> > eval1(If Fls t2 t3) = Just t3
> > eval1(If t1 t2 t3) =  case eval t1
> >                     where eval1(If t1 t2 t3) =  Just t1
> >
> > eval :: Term -> Term
> > eval (IsZero Zero) = Tru
> > eval (Zero) = Zero
> > eval(Pred Zero) = Pred Zero
>
> Your case statement is incomplete for starters...
>
> Can you please provide the actual error message as well?  Your
> definition of Term would also be useful.
>
> >
> > On Mon, Oct 17, 2011 at 3:46 PM, Ivan Lazar Miljenovic
> > <ivan.miljenovic at gmail.com> wrote:
> >>
> >> On 18 October 2011 08:43, kolli kolli <nammukolli04 at gmail.com> wrote:
> >> > hey can anyone tell me what is parser error in parser??Plz help me out
> >>
> >> It's when the parser can't parse what it's provided.... providing the
> >> code that caused the problem and the actual error message is required
> >> for a more detailed explanation.
> >>
> >> --
> >> Ivan Lazar Miljenovic
> >> Ivan.Miljenovic at gmail.com
> >> IvanMiljenovic.wordpress.com
> >
> >
>
>
>
> --
> Ivan Lazar Miljenovic
> Ivan.Miljenovic at gmail.com
> IvanMiljenovic.wordpress.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20111017/6ba75628/attachment-0001.htm>


More information about the Beginners mailing list