[Haskell-beginners] another type problem

Sumit Sahrawat, Maths & Computing, IIT (BHU) sumit.sahrawat.apm13 at iitbhu.ac.in
Tue May 12 14:26:20 UTC 2015


Also remember that Just has the type

    Just :: a -> Maybe a

Thus putting in a Just doesn't help with your issue.

On 12 May 2015 at 19:54, Sumit Sahrawat, Maths & Computing, IIT (BHU) <
sumit.sahrawat.apm13 at iitbhu.ac.in> wrote:

> The type of the cons operator (:) is
>
>     (:) :: a -> [a] -> [a]
>
> The way you are invoking it expects it to have the type
>
>     (:) :: a -> Maybe [a] -> [a] -- not valid
>
> One solution is to write such a function yourself, while the other would
> be to rewrite your code to invoke it correctly.
>
> On 12 May 2015 at 19:46, Brandon Allbery <allbery.b at gmail.com> wrote:
>
>> On Tue, May 12, 2015 at 10:11 AM, Roelof Wobben <r.wobben at home.nl> wrote:
>>
>>>  I do not understand what you are saying to me.
>>>
>>> I know that init produces a Maybe [a] . That is why I did put a Just
>>> before it.
>>>
>>
>> You are invoking it again though, and using its result as if it produces
>> [a] instead of Maybe [a].
>>
>> --
>> brandon s allbery kf8nh                               sine nomine
>> associates
>> allbery.b at gmail.com
>> ballbery at sinenomine.net
>> unix, openafs, kerberos, infrastructure, xmonad
>> http://sinenomine.net
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>>
>
>
> --
> Regards
>
> Sumit Sahrawat
>



-- 
Regards

Sumit Sahrawat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150512/f4833a46/attachment.html>


More information about the Beginners mailing list