How to get the value of a Maybe in Haskell

前端 未结 5 697
南旧
南旧 2021-01-31 08:15

I\'m relatively new to Haskell and began to read \"Real World Haskell\".

I Just stumbled over the type Maybe and have a question about how to receive the actual value fr

5条回答
  •  青春惊慌失措
    2021-01-31 09:20

    This is the answer I was looking for when I came to this question:

    https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Maybe.html#v:fromJust

    ...and similarly, for Either:

    https://hackage.haskell.org/package/either-unwrap-1.1/docs/Data-Either-Unwrap.html

    They provide functions I would have written myself which unwrap the value from its context.

提交回复
热议问题