[Haskell-beginners] guards

kolli kolli nammukolli04 at gmail.com
Thu Nov 10 23:55:48 CET 2011


I have to feame the code saying in IF t1 t2 t3

If t1 has type x and if type of t2 == type of t3 then return type of t2 or
t3

On Thu, Nov 10, 2011 at 3:51 PM, Chaddaï Fouché <chaddai.fouche at gmail.com>wrote:

> On Thu, Nov 10, 2011 at 11:37 PM, kolli kolli <nammukolli04 at gmail.com>
> wrote:
> > its giving me  error
> >
> >     Couldn't match expected type `Maybe Type'
> >            against inferred type `Type'
> >     In the second argument of `(==)', namely `TypeBool'
> >     In the first argument of `(&&)', namely
> >         `typing capGama t1 == TypeBool'
> >     In the expression:
> >             typing capGama t1 == TypeBool && typing capGama t2 ==
> TypeBool
> >
>
> The problem is clearly not that you're using (&&) (which is the
> correct way to have two conditions in one guard) but that "typing
> capGama t1" is of type "Maybe Type" while TypeBool is of type "Type",
> so you can't compare them with an (==), maybe you meant to use "Just
> TypeBool" ?
>
> --
> Jedaï
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20111110/9cb800e9/attachment.htm>


More information about the Beginners mailing list