Hoogle Search

Within LTS Haskell 24.2 (ghc-9.10.2)

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

  1. lookup :: Eq a => a -> [(a, b)] -> Maybe b

    base Prelude

    lookup key assocs looks up a key in an association list. For the result to be Nothing, the list must be finite.

    Examples

    >>> lookup 2 []
    Nothing
    
    >>> lookup 2 [(1, "first")]
    Nothing
    
    >>> lookup 2 [(1, "first"), (2, "second"), (3, "third")]
    Just "second"
    

  2. lookup :: Eq a => a -> [(a, b)] -> Maybe b

    base Data.List

    lookup key assocs looks up a key in an association list. For the result to be Nothing, the list must be finite.

    Examples

    >>> lookup 2 []
    Nothing
    
    >>> lookup 2 [(1, "first")]
    Nothing
    
    >>> lookup 2 [(1, "first"), (2, "second"), (3, "third")]
    Just "second"
    

  3. lookup :: Eq a => a -> [(a, b)] -> Maybe b

    base GHC.List

    lookup key assocs looks up a key in an association list. For the result to be Nothing, the list must be finite.

    Examples

    >>> lookup 2 []
    Nothing
    
    >>> lookup 2 [(1, "first")]
    Nothing
    
    >>> lookup 2 [(1, "first"), (2, "second"), (3, "third")]
    Just "second"
    

  4. lookup :: Key -> IntMap a -> Maybe a

    containers Data.IntMap.Internal

    Lookup the value at a key in the map. See also lookup.

  5. lookup :: Key -> IntMap a -> Maybe a

    containers Data.IntMap.Lazy

    Lookup the value at a key in the map. See also lookup.

  6. lookup :: Key -> IntMap a -> Maybe a

    containers Data.IntMap.Strict

    Lookup the value at a key in the map. See also lookup.

  7. lookup :: Key -> IntMap a -> Maybe a

    containers Data.IntMap.Strict.Internal

    Lookup the value at a key in the map. See also lookup.

  8. lookup :: Ord k => k -> Map k a -> Maybe a

    containers Data.Map.Internal

    Lookup the value at a key in the map. The function will return the corresponding value as (Just value), or Nothing if the key isn't in the map. An example of using lookup:

    import Prelude hiding (lookup)
    import Data.Map
    
    employeeDept = fromList([("John","Sales"), ("Bob","IT")])
    deptCountry = fromList([("IT","USA"), ("Sales","France")])
    countryCurrency = fromList([("USA", "Dollar"), ("France", "Euro")])
    
    employeeCurrency :: String -> Maybe String
    employeeCurrency name = do
    dept <- lookup name employeeDept
    country <- lookup dept deptCountry
    lookup country countryCurrency
    
    main = do
    putStrLn $ "John's currency: " ++ (show (employeeCurrency "John"))
    putStrLn $ "Pete's currency: " ++ (show (employeeCurrency "Pete"))
    
    The output of this program:
    John's currency: Just "Euro"
    Pete's currency: Nothing
    

  9. lookup :: Ord k => k -> Map k a -> Maybe a

    containers Data.Map.Lazy

    Lookup the value at a key in the map. The function will return the corresponding value as (Just value), or Nothing if the key isn't in the map. An example of using lookup:

    import Prelude hiding (lookup)
    import Data.Map
    
    employeeDept = fromList([("John","Sales"), ("Bob","IT")])
    deptCountry = fromList([("IT","USA"), ("Sales","France")])
    countryCurrency = fromList([("USA", "Dollar"), ("France", "Euro")])
    
    employeeCurrency :: String -> Maybe String
    employeeCurrency name = do
    dept <- lookup name employeeDept
    country <- lookup dept deptCountry
    lookup country countryCurrency
    
    main = do
    putStrLn $ "John's currency: " ++ (show (employeeCurrency "John"))
    putStrLn $ "Pete's currency: " ++ (show (employeeCurrency "Pete"))
    
    The output of this program:
    John's currency: Just "Euro"
    Pete's currency: Nothing
    

  10. lookup :: Ord k => k -> Map k a -> Maybe a

    containers Data.Map.Strict

    Lookup the value at a key in the map. The function will return the corresponding value as (Just value), or Nothing if the key isn't in the map. An example of using lookup:

    import Prelude hiding (lookup)
    import Data.Map
    
    employeeDept = fromList([("John","Sales"), ("Bob","IT")])
    deptCountry = fromList([("IT","USA"), ("Sales","France")])
    countryCurrency = fromList([("USA", "Dollar"), ("France", "Euro")])
    
    employeeCurrency :: String -> Maybe String
    employeeCurrency name = do
    dept <- lookup name employeeDept
    country <- lookup dept deptCountry
    lookup country countryCurrency
    
    main = do
    putStrLn $ "John's currency: " ++ (show (employeeCurrency "John"))
    putStrLn $ "Pete's currency: " ++ (show (employeeCurrency "Pete"))
    
    The output of this program:
    John's currency: Just "Euro"
    Pete's currency: Nothing
    

Page 1 of many | Next