Try fromMaybe [1]. Examples
Prelude Data.Maybe> fromMaybe [] (Just [1,2,3])[1,2,3]Prelude Data.Maybe> fromMaybe [1,2,3] Nothing[1,2,3]
On Tue, May 12, 2015 at 5:28 PM Roelof Wobben <r.wobben@home.nl> wrote:
Oke,
And how do I do this. Haskell is a difficult one to learn,
Roelof
Alexey Shmalko schreef op 12-5-2015 om 16:24:
_______________________________________________Before cons'ing the result of init', you should check whether it's Just or Nothing. What you're doing now is something along the line with 5 : Just 3 -- this won't typecheck.
On Tue, May 12, 2015 at 5:22 PM Roelof Wobben <r.wobben@home.nl> wrote:
Brandon Allbery schreef op 12-5-2015 om 16:16:
On Tue, May 12, 2015 at 10:11 AM, Roelof Wobben <r.wobben@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 associatesunix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
What is then the right way to do. I still do not understand what you are trying to make clear to me._______________________________________________
Roelof
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
![]()
Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware.
www.avast.com
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
![]() |
Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware.
|