HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulerelude-1.2.0.0Haskell2010

Relude.Container.Reexport

SPDX-License-Identifier : MIT Maintainer : Kowainik xrom.xkov@gmail.com Stability : Stable Portability : Portable

Reexports container-related data types, functions and typeclasses from base, containers and unordered-containers packages.

  • 7 types
  • 2 classes
  • 5 values
  • Packagerelude-1.2.0.0
  • Exports14
  • LanguageHaskell2010
  • LicenceMIT
  • SourceReexport.hs

Data.Hashable reexports

1 declaration
classclass Eq a => Hashable a where
#

The class of types that can be converted to a hash value.

Minimal implementation: hashWithSalt.

Hashable is intended exclusively for use in in-memory data structures. . Hashable does not have a fixed standard. This allows it to improve over time. . Because it does not have a fixed standard, different computers or computers on different versions of the code will observe different hash values. As such, Hashable is not recommended for use other than in-memory datastructures. Specifically, Hashable is not intended for network use or in applications which persist hashed values. For stable hashing use named hashes: sha256, crc32, xxhash etc.

If you are looking for Hashable instance in time package, check time-compat

Methods

  • hashWithSalt :: Int -> a -> Intinfixl 0

    Return a hash value for the argument, using the given salt.

    The general contract of hashWithSalt is:

    • If two values are equal according to the == method, then applying the hashWithSalt method on each of the two values must produce the same integer result if the same salt is used in each case.

    • It is not required that if two values are unequal according to the == method, then applying the hashWithSalt method on each of the two values must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal values may improve the performance of hashing-based data structures.

    • This method can be used to compute different hash values for the same input by providing a different salt in each application of the method. This implies that any instance that defines hashWithSalt must make use of the salt in its implementation.

    • hashWithSalt may return negative Int values.

Instances75Hashable, …

Data.HashMap.Strict reexports

1 declaration
datadata HashMap k v
#

A map from keys to values. A map cannot contain duplicate keys; each key can map to at most one value.

Instances33Bifoldable, Eq2, Ord2, Show2, NFData2, Hashable2, …
  • Bifoldable HashMapDefined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • Eq2 HashMapDefined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • Ord2 HashMapDefined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • Show2 HashMapDefined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • NFData2 HashMapDefined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • Hashable2 HashMapDefined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • (Lift k, Lift v) => Lift (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • Functor (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • Foldable (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • Traversable (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • Eq k => Eq1 (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • Ord k => Ord1 (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • (Hashable k, Read k) => Read1 (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • Show k => Show1 (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • NFData k => NFData1 (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • Hashable k => Hashable1 (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • Hashable k => IsList (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • (Eq k, Eq v) => Eq (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal

    Note that, in the presence of hash collisions, equal HashMaps may behave differently, i.e. extensionality may be violated:

    Example2 expressions
    data D = A | B deriving (Eq, Show)instance Hashable D where hashWithSalt salt _d = salt
    Example2 expressions
    x = fromList [(A,1), (B,2)]y = fromList [(B,2), (A,1)]
    Example3 expressions
    x == yTruetoList x[(A,1),(B,2)]toList y[(B,2),(A,1)]

    In general, the lack of extensionality can be observed with any function that depends on the key ordering, such as folds and traversals.

  • (Data k, Data v, Hashable k) => Data (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • (Ord k, Ord v) => Ord (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal

    The ordering is total and consistent with the Eq instance. However, nothing else about the ordering is specified, and it may change from version to version of either this package or of hashable.

  • (Hashable k, Read k, Read e) => Read (HashMap k e)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • (Show k, Show v) => Show (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • Hashable k => Semigroup (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal

    <> = union

    If a key occurs in both maps, the mapping from the first will be the mapping in the result.

    Examples
    Example1 expression
    fromList [(1,'a'),(2,'b')] <> fromList [(2,'c'),(3,'d')]fromList [(1,'a'),(2,'b'),(3,'d')]
  • Hashable k => Monoid (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal

    mempty = empty

    mappend = union

    If a key occurs in both maps, the mapping from the first will be the mapping in the result.

    Examples
    Example1 expression
    mappend (fromList [(1,'a'),(2,'b')]) (fromList [(2,'c'),(3,'d')])fromList [(1,'a'),(2,'b'),(3,'d')]
  • (NFData k, NFData v) => NFData (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • (Hashable k, Hashable v) => Hashable (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • Hashable k => One (HashMap k v)Defined in relude-1.2.0.0 · Relude.Container.One

    Create singleton HashMap from key-value pair.

    Example1 expression
    one (3, "foo") :: HashMap Int TextfromList [(3,"foo")]
    law> Relude.length (one @(HashMap k v) (k, v)) ≡ 1
    
  • Hashable k => DynamicMap (HashMap k v)Defined in relude-1.2.0.0 · Relude.Extra.Map
  • Hashable k => StaticMap (HashMap k v)Defined in relude-1.2.0.0 · Relude.Extra.Map
  • type Item (HashMap k v) = (k, v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • type OneItem (HashMap k v) = (k, v)Defined in relude-1.2.0.0 · Relude.Container.One
  • type Key (HashMap k v) = kDefined in relude-1.2.0.0 · Relude.Extra.Map
  • type Val (HashMap k v) = vDefined in relude-1.2.0.0 · Relude.Extra.Map

Data.HashSet reexports

1 declaration
newtypenewtype HashSet a
#

A set of values. A set cannot contain duplicate values.

Instances23Foldable, Eq1, Ord1, Show1, NFData1, Hashable1, …
  • Foldable HashSetDefined in unordered-containers-0.2.21 · Data.HashSet.Internal
  • Eq1 HashSetDefined in unordered-containers-0.2.21 · Data.HashSet.Internal
  • Ord1 HashSetDefined in unordered-containers-0.2.21 · Data.HashSet.Internal
  • Show1 HashSetDefined in unordered-containers-0.2.21 · Data.HashSet.Internal
  • NFData1 HashSetDefined in unordered-containers-0.2.21 · Data.HashSet.Internal
  • Hashable1 HashSetDefined in unordered-containers-0.2.21 · Data.HashSet.Internal
  • Lift a => Lift (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.Internal
  • Hashable a => IsList (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.Internal
  • Eq a => Eq (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.Internal

    Note that, in the presence of hash collisions, equal HashSets may behave differently, i.e. extensionality may be violated:

    Example2 expressions
    data D = A | B deriving (Eq, Show)instance Hashable D where hashWithSalt salt _d = salt
    Example2 expressions
    x = fromList [A, B]y = fromList [B, A]
    Example3 expressions
    x == yTruetoList x[A,B]toList y[B,A]

    In general, the lack of extensionality can be observed with any function that depends on the key ordering, such as folds and traversals.

  • (Data a, Hashable a) => Data (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.Internal
  • Ord a => Ord (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.Internal
  • (Hashable a, Read a) => Read (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.Internal
  • Show a => Show (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.Internal
  • Hashable a => Semigroup (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.Internal

    <> = union

    O(n+m)

    To obtain good performance, the smaller set must be presented as the first argument.

    Examples
    Example1 expression
    fromList [1,2] <> fromList [2,3]fromList [1,2,3]
  • Hashable a => Monoid (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.Internal

    mempty = empty

    mappend = union

    O(n+m)

    To obtain good performance, the smaller set must be presented as the first argument.

    Examples
    Example1 expression
    mappend (fromList [1,2]) (fromList [2,3])fromList [1,2,3]
  • NFData a => NFData (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.Internal
  • Hashable a => Hashable (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.Internal
  • Hashable a => One (HashSet a)Defined in relude-1.2.0.0 · Relude.Container.One

    Create singleton HashSet.

    Example1 expression
    one 42 :: HashSet IntfromList [42]
    law> Relude.length (one @(HashSet a) x) ≡ 1
    
  • Hashable a => StaticMap (HashSet a)Defined in relude-1.2.0.0 · Relude.Extra.Map
  • type Item (HashSet a) = aDefined in unordered-containers-0.2.21 · Data.HashSet.Internal
  • type OneItem (HashSet a) = aDefined in relude-1.2.0.0 · Relude.Container.One
  • type Key (HashSet a) = aDefined in relude-1.2.0.0 · Relude.Extra.Map
  • type Val (HashSet a) = aDefined in relude-1.2.0.0 · Relude.Extra.Map

Data.IntMap.Strict reexports

1 declaration
datadata IntMap a
#

A map of integers to values a.

Instances27Functor, Foldable, Traversable, Eq1, Ord1, Read1, …
  • Functor IntMapDefined in containers-0.7 · Data.IntMap.Internal
  • Foldable IntMapDefined in containers-0.7 · Data.IntMap.Internal

    Folds in order of increasing key.

  • Traversable IntMapDefined in containers-0.7 · Data.IntMap.Internal

    Traverses in order of increasing key.

  • Eq1 IntMapDefined in containers-0.7 · Data.IntMap.Internal
  • Ord1 IntMapDefined in containers-0.7 · Data.IntMap.Internal
  • Read1 IntMapDefined in containers-0.7 · Data.IntMap.Internal
  • Show1 IntMapDefined in containers-0.7 · Data.IntMap.Internal
  • Hashable1 IntMapDefined in hashable-1.4.7.0 · Data.Hashable.Class
  • Lift a => Lift (IntMap a)Defined in containers-0.7 · Data.IntMap.Internal
  • IsList (IntMap a)Defined in containers-0.7 · Data.IntMap.Internal
  • Eq a => Eq (IntMap a)Defined in containers-0.7 · Data.IntMap.Internal
  • Data a => Data (IntMap a)Defined in containers-0.7 · Data.IntMap.Internal
  • Ord a => Ord (IntMap a)Defined in containers-0.7 · Data.IntMap.Internal
  • Read e => Read (IntMap e)Defined in containers-0.7 · Data.IntMap.Internal
  • Show a => Show (IntMap a)Defined in containers-0.7 · Data.IntMap.Internal
  • Semigroup (IntMap a)Defined in containers-0.7 · Data.IntMap.Internal
  • Monoid (IntMap a)Defined in containers-0.7 · Data.IntMap.Internal
  • NFData a => NFData (IntMap a)Defined in containers-0.7 · Data.IntMap.Internal
  • Binary e => Binary (IntMap e)Defined in binary-0.8.9.3 · Data.Binary.Class
  • Hashable v => Hashable (IntMap v)Defined in hashable-1.4.7.0 · Data.Hashable.Class
  • One (IntMap v)Defined in relude-1.2.0.0 · Relude.Container.One

    Create singleton IntMap from key-value pair.

    Example1 expression
    one (3, "foo") :: IntMap TextfromList [(3,"foo")]
    law> Relude.length (one @(IntMap a) x) ≡ 1
    
  • DynamicMap (IntMap v)Defined in relude-1.2.0.0 · Relude.Extra.Map
  • StaticMap (IntMap v)Defined in relude-1.2.0.0 · Relude.Extra.Map
  • type Item (IntMap a) = (Key, a)Defined in containers-0.7 · Data.IntMap.Internal
  • type OneItem (IntMap v) = (Int, v)Defined in relude-1.2.0.0 · Relude.Container.One
  • type Key (IntMap v) = IntDefined in relude-1.2.0.0 · Relude.Extra.Map
  • type Val (IntMap v) = vDefined in relude-1.2.0.0 · Relude.Extra.Map

Data.IntSet reexports

1 declaration
datadata IntSet
#

A set of integers.

Instances18IsList, Eq, Data, Ord, Read, Show, …
  • IsList IntSetDefined in containers-0.7 · Data.IntSet.Internal
  • Eq IntSetDefined in containers-0.7 · Data.IntSet.Internal
  • Data IntSetDefined in containers-0.7 · Data.IntSet.Internal
  • Ord IntSetDefined in containers-0.7 · Data.IntSet.Internal
  • Read IntSetDefined in containers-0.7 · Data.IntSet.Internal
  • Show IntSetDefined in containers-0.7 · Data.IntSet.Internal
  • Semigroup IntSetDefined in containers-0.7 · Data.IntSet.Internal
  • Monoid IntSetDefined in containers-0.7 · Data.IntSet.Internal
  • NFData IntSetDefined in containers-0.7 · Data.IntSet.Internal
  • Binary IntSetDefined in binary-0.8.9.3 · Data.Binary.Class
  • Hashable IntSetDefined in hashable-1.4.7.0 · Data.Hashable.Class
  • One IntSetDefined in relude-1.2.0.0 · Relude.Container.One

    Create singleton IntSet.

    Example1 expression
    one 42 :: IntSetfromList [42]
    law> size (one x) ≡ 1
    
  • StaticMap IntSetDefined in relude-1.2.0.0 · Relude.Extra.Map
  • Lift IntSetDefined in containers-0.7 · Data.IntSet.Internal
  • type Item IntSet = KeyDefined in containers-0.7 · Data.IntSet.Internal
  • type OneItem IntSet = IntDefined in relude-1.2.0.0 · Relude.Container.One
  • type Key IntSet = IntDefined in relude-1.2.0.0 · Relude.Extra.Map
  • type Val IntSet = IntDefined in relude-1.2.0.0 · Relude.Extra.Map

Data.Map.Strict reexports

1 declaration
datadata Map k a
#

A Map from keys k to values a.

The Semigroup operation for Map is union, which prefers values from the left operand. If m1 maps a key k to a value a1, and m2 maps the same key to a different value a2, then their union m1 <> m2 maps k to a1.

Instances32Bifoldable, Eq2, Ord2, Show2, Hashable2, Lift, …
  • Bifoldable MapDefined in containers-0.7 · Data.Map.Internal
  • Eq2 MapDefined in containers-0.7 · Data.Map.Internal
  • Ord2 MapDefined in containers-0.7 · Data.Map.Internal
  • Show2 MapDefined in containers-0.7 · Data.Map.Internal
  • Hashable2 MapDefined in hashable-1.4.7.0 · Data.Hashable.Class
  • (Lift k, Lift a) => Lift (Map k a)Defined in containers-0.7 · Data.Map.Internal
  • Functor (Map k)Defined in containers-0.7 · Data.Map.Internal
  • Foldable (Map k)Defined in containers-0.7 · Data.Map.Internal

    Folds in order of increasing key.

  • Traversable (Map k)Defined in containers-0.7 · Data.Map.Internal

    Traverses in order of increasing key.

  • Eq k => Eq1 (Map k)Defined in containers-0.7 · Data.Map.Internal
  • Ord k => Ord1 (Map k)Defined in containers-0.7 · Data.Map.Internal
  • (Ord k, Read k) => Read1 (Map k)Defined in containers-0.7 · Data.Map.Internal
  • Show k => Show1 (Map k)Defined in containers-0.7 · Data.Map.Internal
  • Hashable k => Hashable1 (Map k)Defined in hashable-1.4.7.0 · Data.Hashable.Class
  • Ord k => IsList (Map k v)Defined in containers-0.7 · Data.Map.Internal
  • (Eq k, Eq a) => Eq (Map k a)Defined in containers-0.7 · Data.Map.Internal
  • (Data k, Data a, Ord k) => Data (Map k a)Defined in containers-0.7 · Data.Map.Internal
  • (Ord k, Ord v) => Ord (Map k v)Defined in containers-0.7 · Data.Map.Internal
  • (Ord k, Read k, Read e) => Read (Map k e)Defined in containers-0.7 · Data.Map.Internal
  • (Show k, Show a) => Show (Map k a)Defined in containers-0.7 · Data.Map.Internal
  • Ord k => Semigroup (Map k v)Defined in containers-0.7 · Data.Map.Internal
  • Ord k => Monoid (Map k v)Defined in containers-0.7 · Data.Map.Internal
  • (NFData k, NFData a) => NFData (Map k a)Defined in containers-0.7 · Data.Map.Internal
  • (Binary k, Binary e) => Binary (Map k e)Defined in binary-0.8.9.3 · Data.Binary.Class
  • (Hashable k, Hashable v) => Hashable (Map k v)Defined in hashable-1.4.7.0 · Data.Hashable.Class
  • One (Map k v)Defined in relude-1.2.0.0 · Relude.Container.One

    Create singleton Map from key-value pair.

    Example1 expression
    one (3, "foo") :: Map Int TextfromList [(3,"foo")]
    law> Relude.length (one @(Map k v) (k, v)) ≡ 1
    
  • Ord k => DynamicMap (Map k v)Defined in relude-1.2.0.0 · Relude.Extra.Map
  • Ord k => StaticMap (Map k v)Defined in relude-1.2.0.0 · Relude.Extra.Map
  • type Item (Map k v) = (k, v)Defined in containers-0.7 · Data.Map.Internal
  • type OneItem (Map k v) = (k, v)Defined in relude-1.2.0.0 · Relude.Container.One
  • type Key (Map k v) = kDefined in relude-1.2.0.0 · Relude.Extra.Map
  • type Val (Map k v) = vDefined in relude-1.2.0.0 · Relude.Extra.Map

Data.Sequence reexports

1 declaration
newtypenewtype Seq a
#

General-purpose finite sequences.

Instances31Monad, Functor, MonadFix, Applicative, Foldable, Traversable, …
  • Monad SeqDefined in containers-0.7 · Data.Sequence.Internal
  • Functor SeqDefined in containers-0.7 · Data.Sequence.Internal
  • MonadFix SeqDefined in containers-0.7 · Data.Sequence.Internal
  • Applicative SeqDefined in containers-0.7 · Data.Sequence.Internal
  • Foldable SeqDefined in containers-0.7 · Data.Sequence.Internal
  • Traversable SeqDefined in containers-0.7 · Data.Sequence.Internal
  • Alternative SeqDefined in containers-0.7 · Data.Sequence.Internal
  • MonadPlus SeqDefined in containers-0.7 · Data.Sequence.Internal
  • MonadZip SeqDefined in containers-0.7 · Data.Sequence.Internal
  • Eq1 SeqDefined in containers-0.7 · Data.Sequence.Internal
  • Ord1 SeqDefined in containers-0.7 · Data.Sequence.Internal
  • Read1 SeqDefined in containers-0.7 · Data.Sequence.Internal
  • Show1 SeqDefined in containers-0.7 · Data.Sequence.Internal
  • UnzipWith SeqDefined in containers-0.7 · Data.Sequence.Internal
  • Hashable1 SeqDefined in hashable-1.4.7.0 · Data.Hashable.Class
  • Lift a => Lift (Seq a)Defined in containers-0.7 · Data.Sequence.Internal
  • IsList (Seq a)Defined in containers-0.7 · Data.Sequence.Internal
  • Eq a => Eq (Seq a)Defined in containers-0.7 · Data.Sequence.Internal
  • Data a => Data (Seq a)Defined in containers-0.7 · Data.Sequence.Internal
  • Ord a => Ord (Seq a)Defined in containers-0.7 · Data.Sequence.Internal
  • Read a => Read (Seq a)Defined in containers-0.7 · Data.Sequence.Internal
  • Show a => Show (Seq a)Defined in containers-0.7 · Data.Sequence.Internal
  • a ~ Char => IsString (Seq a)Defined in containers-0.7 · Data.Sequence.Internal
  • Semigroup (Seq a)Defined in containers-0.7 · Data.Sequence.Internal
  • Monoid (Seq a)Defined in containers-0.7 · Data.Sequence.Internal
  • NFData a => NFData (Seq a)Defined in containers-0.7 · Data.Sequence.Internal
  • Binary e => Binary (Seq e)Defined in binary-0.8.9.3 · Data.Binary.Class
  • Hashable v => Hashable (Seq v)Defined in hashable-1.4.7.0 · Data.Hashable.Class
  • One (Seq a)Defined in relude-1.2.0.0 · Relude.Container.One

    Create singleton Seq.

    Example1 expression
    one 42 :: Seq IntfromList [42]
    law> Relude.length (one @(Seq a) x) ≡ 1
    
  • type Item (Seq a) = aDefined in containers-0.7 · Data.Sequence.Internal
  • type OneItem (Seq a) = aDefined in relude-1.2.0.0 · Relude.Container.One

Data.Set reexports

1 declaration
datadata Set a
#

A set of values a.

Instances23Foldable, Eq1, Ord1, Show1, Hashable1, Lift, …
  • Foldable SetDefined in containers-0.7 · Data.Set.Internal

    Folds in order of increasing key.

  • Eq1 SetDefined in containers-0.7 · Data.Set.Internal
  • Ord1 SetDefined in containers-0.7 · Data.Set.Internal
  • Show1 SetDefined in containers-0.7 · Data.Set.Internal
  • Hashable1 SetDefined in hashable-1.4.7.0 · Data.Hashable.Class
  • Lift a => Lift (Set a)Defined in containers-0.7 · Data.Set.Internal
  • Ord a => IsList (Set a)Defined in containers-0.7 · Data.Set.Internal
  • Eq a => Eq (Set a)Defined in containers-0.7 · Data.Set.Internal
  • (Data a, Ord a) => Data (Set a)Defined in containers-0.7 · Data.Set.Internal
  • Ord a => Ord (Set a)Defined in containers-0.7 · Data.Set.Internal
  • (Read a, Ord a) => Read (Set a)Defined in containers-0.7 · Data.Set.Internal
  • Show a => Show (Set a)Defined in containers-0.7 · Data.Set.Internal
  • Ord a => Semigroup (Set a)Defined in containers-0.7 · Data.Set.Internal
  • Ord a => Monoid (Set a)Defined in containers-0.7 · Data.Set.Internal
  • NFData a => NFData (Set a)Defined in containers-0.7 · Data.Set.Internal
  • Binary a => Binary (Set a)Defined in binary-0.8.9.3 · Data.Binary.Class
  • Hashable v => Hashable (Set v)Defined in hashable-1.4.7.0 · Data.Hashable.Class
  • One (Set a)Defined in relude-1.2.0.0 · Relude.Container.One

    Create singleton Set.

    Example1 expression
    one 42 :: Set IntfromList [42]
    law> Relude.length (one @(Set a) x) ≡ 1
    
  • Ord a => StaticMap (Set a)Defined in relude-1.2.0.0 · Relude.Extra.Map
  • type Item (Set a) = aDefined in containers-0.7 · Data.Set.Internal
  • type OneItem (Set a) = aDefined in relude-1.2.0.0 · Relude.Container.One
  • type Key (Set a) = aDefined in relude-1.2.0.0 · Relude.Extra.Map
  • type Val (Set a) = aDefined in relude-1.2.0.0 · Relude.Extra.Map

Data.Tuple reexports

5 declarations
valuecurry :: ((a, b) -> c) -> a -> b -> c
#

Convert an uncurried function to a curried function.

Examples
Example1 expression
curry fst 1 21
valuefst :: (a, b) -> a
#

Extract the first component of a pair.

valuesnd :: (a, b) -> b
#

Extract the second component of a pair.

valueswap :: (a, b) -> (b, a)
#

Swap the components of a pair.

valueuncurry :: (a -> b -> c) -> (a, b) -> c
#

uncurry converts a curried function to a function on pairs.

Examples
Example1 expression
uncurry (+) (1,2)3
Example1 expression
uncurry ($) (show, 1)"1"
Example1 expression
map (uncurry max) [(1,2), (3,4), (6,8)][2,4,8]

GHC.Exts reexports

1 declaration
classclass IsList l where
#

The IsList class and its methods are intended to be used in conjunction with the OverloadedLists extension.

Methods

  • fromList :: [Item l] -> l

    The fromList function constructs the structure l from the given list of Item l

  • fromListN :: Int -> [Item l] -> l

    The fromListN function takes the input list's length and potentially uses it to construct the structure l more efficiently compared to fromList. If the given number does not equal to the input list's length the behaviour of fromListN is not specified.

    Property
    fromListN (length xs) xs == fromList xs
Instances19IsList, …
  • IsList ByteArrayDefined in base-4.20.2.0 · Data.Array.Byte
  • IsList BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder.Internal

    For long or infinite lists use fromList because it uses LazyByteString otherwise use fromListN which uses StrictByteString.

  • IsList ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Internal.Type
  • IsList ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Lazy.Internal
  • IsList ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.Internal
  • IsList IntSetDefined in containers-0.7 · Data.IntSet.Internal
  • IsList VersionDefined in ghc-internal-9.1003.0 · GHC.Internal.IsList
  • IsList CallStackDefined in ghc-internal-9.1003.0 · GHC.Internal.IsList

    Be aware that 'fromList . toList = id' only for unfrozen CallStacks, since toList removes frozenness information.

  • IsList TextDefined in text-2.1.3 · Data.Text · orphan

    Performs replacement on invalid scalar values:

    Example2 expressions
    :set -XOverloadedLists['\55555'] :: Text"\65533"
  • IsList TextDefined in text-2.1.3 · Data.Text.Lazy · orphan

    Performs replacement on invalid scalar values:

    Example2 expressions
    :set -XOverloadedLists['\55555'] :: Data.Text.Lazy.Text"\65533"
  • IsList (IntMap a)Defined in containers-0.7 · Data.IntMap.Internal
  • IsList (Seq a)Defined in containers-0.7 · Data.Sequence.Internal
  • IsList (NonEmpty a)Defined in ghc-internal-9.1003.0 · GHC.Internal.IsList
  • IsList (ZipList a)Defined in ghc-internal-9.1003.0 · GHC.Internal.IsList
  • IsList [a]Defined in ghc-internal-9.1003.0 · GHC.Internal.IsList
  • Ord a => IsList (Set a)Defined in containers-0.7 · Data.Set.Internal
  • Hashable a => IsList (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.Internal
  • Ord k => IsList (Map k v)Defined in containers-0.7 · Data.Map.Internal
  • Hashable k => IsList (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal