Hoogle Search
Within LTS Haskell 24.60 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
lookup :: Routable k => AddrRange k -> IPRTable k a -> Maybe aiproute Data.IP.RouteTable The lookup function looks up IPRTable with a key of AddrRange. If a routing information in IPRTable matches the key, its value is returned.
>>> let v4 = ["133.4.0.0/16","133.5.0.0/16","133.5.16.0/24","133.5.23.0/24"] :: [AddrRange IPv4] >>> let rt = fromList $ zip v4 v4 >>> lookup "127.0.0.1" rt Nothing >>> lookup "133.3.0.1" rt Nothing >>> lookup "133.4.0.0" rt Just 133.4.0.0/16 >>> lookup "133.4.0.1" rt Just 133.4.0.0/16 >>> lookup "133.5.16.0" rt Just 133.5.16.0/24 >>> lookup "133.5.16.1" rt Just 133.5.16.0/24
lookup :: Routable k => AddrRange k -> IPRTable k a -> Maybe aiproute Data.IP.RouteTable.Internal The lookup function looks up IPRTable with a key of AddrRange. If a routing information in IPRTable matches the key, its value is returned.
>>> let v4 = ["133.4.0.0/16","133.5.0.0/16","133.5.16.0/24","133.5.23.0/24"] :: [AddrRange IPv4] >>> let rt = fromList $ zip v4 v4 >>> lookup "127.0.0.1" rt Nothing >>> lookup "133.3.0.1" rt Nothing >>> lookup "133.4.0.0" rt Just 133.4.0.0/16 >>> lookup "133.4.0.1" rt Just 133.4.0.0/16 >>> lookup "133.5.16.0" rt Just 133.5.16.0/24 >>> lookup "133.5.16.1" rt Just 133.5.16.0/24
lookup :: IsMap map => ContainerKey map -> map -> Maybe (MapValue map)mono-traversable Data.Containers Look up a value in a map with a specified key.
lookup :: (Eq k, Hashable k) => k -> HashMap k v -> Maybe vrio RIO.HashMap Return the value to which the specified key is mapped, or Nothing if this map contains no mapping for the key.
lookup :: Eq a => a -> [(a, b)] -> Maybe brio RIO.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"
lookup :: Ord k => k -> Map k a -> Maybe ario RIO.Map 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
lookup :: Eq a => a -> [(a, b)] -> Maybe brio RIO.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"
lookup :: Int -> Seq a -> Maybe ario RIO.Seq The element at the specified position, counting from 0. If the specified position is negative or at least the length of the sequence, lookup returns Nothing.
0 <= i < length xs ==> lookup i xs == Just (toList xs !! i)
i < 0 || i >= length xs ==> lookup i xs = Nothing
Unlike index, this can be used to retrieve an element without forcing it. For example, to insert the fifth element of a sequence xs into a Map m at key k, you could usecase lookup 5 xs of Nothing -> m Just x -> insert k x m
lookup :: (HashTable h, Eq k, Hashable k) => h s k v -> k -> ST s (Maybe v)hashtables Data.HashTable.Class Looks up a key-value mapping in a hash table. O(n) worst case, (O(1) for cuckoo hash), O(1) amortized.
lookup :: (HashTable h, Eq k, Hashable k) => IOHashTable h k v -> k -> IO (Maybe v)hashtables Data.HashTable.IO See the documentation for this function in lookup.