HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduletree-diff-0.3.4Haskell2010

Data.TreeDiff.OMap

Map which remembers the fromList order. This module is minimal on purpose.

  • 1 type
  • 5 values
  • Packagetree-diff-0.3.4
  • Exports6
  • LanguageHaskell2010
  • LicenceGPL-2.0-or-later
  • SourceOMap.hs

Ordered map

1 declaration
newtypenewtype OMap k v
#
Instances8Functor, Arbitrary1, Semialign, Eq, Ord, Show, …
  • Functor (OMap k)Defined in tree-diff-0.3.4 · Data.TreeDiff.OMap
  • (Ord k, Arbitrary k) => Arbitrary1 (OMap k)Defined in tree-diff-0.3.4 · Data.TreeDiff.OMap
  • Ord k => Semialign (OMap k)Defined in tree-diff-0.3.4 · Data.TreeDiff.OMap
    Example3 expressions
    let xs = fromList [('a', "alpha"), ('b', "beta")]let ys = fromList [('c', 3 :: Int), ('b', 2)]alignWith id xs ysfromList [('a',This "alpha"),('c',That 3),('b',These "beta" 2)]
  • (Eq k, Eq v) => Eq (OMap k v)Defined in tree-diff-0.3.4 · Data.TreeDiff.OMap
    Example3 expressions
    xs = toAscList $ fromList [('a', "alpha"), ('b', "beta"), ('g', "gamma")]ys = toAscList $ fromList [('g', "gamma"), ('b', "beta"), ('a', "alpha")]xs == ysTrue
    Example2 expressions
    zs = toAscList $ fromList [('d', "delta"), ('b', "beta"), ('a', "alpha")]xs == zsFalse
  • (Ord k, Ord v) => Ord (OMap k v)Defined in tree-diff-0.3.4 · Data.TreeDiff.OMap
  • (Show k, Show v) => Show (OMap k v)Defined in tree-diff-0.3.4 · Data.TreeDiff.OMap

    Note: The instance uses toList, so Equal OMaps can be shown differently.

  • (NFData k, NFData v) => NFData (OMap k v)Defined in tree-diff-0.3.4 · Data.TreeDiff.OMap
  • (Ord k, Arbitrary k, Arbitrary v) => Arbitrary (OMap k v)Defined in tree-diff-0.3.4 · Data.TreeDiff.OMap

Conversions

3 declarations
valuetoAscList :: OMap k v -> [(k, v)]
#
Example1 expression
toAscList $ fromList [('a', "alpha"), ('b', "beta"), ('g', "gamma")][('a',"alpha"),('b',"beta"),('g',"gamma")]
Example1 expression
toAscList $ fromList [('g', "gamma"), ('b', "beta"), ('a', "alpha")][('a',"alpha"),('b',"beta"),('g',"gamma")]
valuetoList :: OMap k v -> [(k, v)]
#

O(n log n). List in creation order. Doesn't respect Eq instance.

Example1 expression
toList $ fromList [('a', "alpha"), ('b', "beta"), ('g', "gamma")][('a',"alpha"),('b',"beta"),('g',"gamma")]
Example1 expression
toList $ fromList [('g', "gamma"), ('b', "beta"), ('a', "alpha")][('g',"gamma"),('b',"beta"),('a',"alpha")]
valuefromList :: Ord k => [(k, v)] -> OMap k v
#
Example1 expression
fromList [('g', "gamma"), ('b', "beta"), ('a', "alpha")]fromList [('g',"gamma"),('b',"beta"),('a',"alpha")]

Construction

1 declaration
valueempty :: OMap k v
#
Example1 expression
empty :: OMap String IntegerfromList []

Query

1 declaration
valueelems :: OMap k v -> [v]
#

Elements in key ascending order.