Copyright | (c) Lars Brünjes, 2016 |
---|---|
License | MIT |
Maintainer | brunjlar@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
This module contains utility functions related to the Traversable
typeclass.
- fromList :: (Applicative t, Traversable t) => [a] -> Maybe (t a)
Documentation
fromList :: (Applicative t, Traversable t) => [a] -> Maybe (t a) Source
Tries to create a traversable (which must also be applicative) from a list.
If the list contains too few elements, Nothing
is returned,
>>>
import Data.MyPrelude
>>>
fromList [1, 2, 3] :: Maybe (Identity Int)
Just (Identity 1)
>>>
fromList [] :: Maybe (Identity Char)
Nothing