Hoogle Search

Within LTS Haskell 24.35 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. maybeToList :: Maybe a -> [a]

    base Data.Maybe

    The maybeToList function returns an empty list when given Nothing or a singleton list when given Just.

    Examples

    Basic usage:
    >>> maybeToList (Just 7)
    [7]
    
    >>> maybeToList Nothing
    []
    
    One can use maybeToList to avoid pattern matching when combined with a function that (safely) works on lists:
    >>> import GHC.Internal.Text.Read ( readMaybe )
    
    >>> sum $ maybeToList (readMaybe "3")
    3
    
    >>> sum $ maybeToList (readMaybe "")
    0
    

  2. biList :: Bifoldable t => t a a -> [a]

    base Data.Bifoldable

    Collects the list of elements of a structure, from left to right.

    Examples

    Basic usage:
    >>> biList (18, 42)
    [18,42]
    
    >>> biList (Left 18)
    [18]
    

  3. toList :: Foldable t => t a -> [a]

    base Data.Foldable

    List of elements of a structure, from left to right. If the entire list is intended to be reduced via a fold, just fold the structure directly bypassing the list.

    Examples

    Basic usage:
    >>> toList Nothing
    []
    
    >>> toList (Just 42)
    [42]
    
    >>> toList (Left "foo")
    []
    
    >>> toList (Node (Leaf 5) 17 (Node Empty 12 (Leaf 8)))
    [5,17,12,8]
    
    For lists, toList is the identity:
    >>> toList [1, 2, 3]
    [1,2,3]
    

  4. liftReadList :: Read1 f => (Int -> ReadS a) -> ReadS [a] -> ReadS [f a]

    base Data.Functor.Classes

    readList function for an application of the type constructor based on readsPrec and readList functions for the argument type. The default implementation using standard list syntax is correct for most types.

  5. liftReadList2 :: Read2 f => (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [f a b]

    base Data.Functor.Classes

    readList function for an application of the type constructor based on readsPrec and readList functions for the argument types. The default implementation using standard list syntax is correct for most types.

  6. liftReadList2Default :: Read2 f => (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [f a b]

    base Data.Functor.Classes

    A possible replacement definition for the liftReadList2 method. This is only needed for Read2 instances where liftReadListPrec2 isn't defined as liftReadListPrec2Default.

  7. liftReadListDefault :: Read1 f => (Int -> ReadS a) -> ReadS [a] -> ReadS [f a]

    base Data.Functor.Classes

    A possible replacement definition for the liftReadList method. This is only needed for Read1 instances where liftReadListPrec isn't defined as liftReadListPrecDefault.

  8. liftReadListPrec :: Read1 f => ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]

    base Data.Functor.Classes

    readListPrec function for an application of the type constructor based on readPrec and readListPrec functions for the argument type. The default definition uses liftReadList. Instances that define liftReadPrec should also define liftReadListPrec as liftReadListPrecDefault.

  9. liftReadListPrec2 :: Read2 f => ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [f a b]

    base Data.Functor.Classes

    readListPrec function for an application of the type constructor based on readPrec and readListPrec functions for the argument types. The default definition uses liftReadList2. Instances that define liftReadPrec2 should also define liftReadListPrec2 as liftReadListPrec2Default.

  10. liftReadListPrec2Default :: Read2 f => ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [f a b]

    base Data.Functor.Classes

    A possible replacement definition for the liftReadListPrec2 method, defined using liftReadPrec2.

Page 32 of many | Previous | Next