Visitar URL original
Utility.AOC
aoc-0.3.0.0: Utility functions commonly used while solving Advent of Code puzzles
Copyright(c) M1n3c4rt 2025
LicenseBSD-3-Clause
Maintainervedicbits@gmail.com
Stabilitystable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Utility.AOC

Description

 
Synopsis

Pathfinding algorithms

All of the following functions return distances as a Maybe Int, where Nothing is returned if no path is found.

The graph is a HashMap mapping each node to a sequence of (neighbour, edge weight) pairs.

Functions that take a graph assume that any neighbour that a node in the graph points to is also in the graph.

shortestDistance Source #

Arguments

:: (Foldable t, Hashable n, Ord a, Num a) 
=> HashMap n (t (n, a))

Graph

-> n

Start node

-> n

End node

-> Maybe a 

Returns the shortest distance between two nodes in a graph.

shortestPaths Source #

Arguments

:: (Foldable t, Hashable n, Ord a, Num a) 
=> HashMap n (t (n, a))

Graph

-> n

Start node

-> n

End node

-> (Maybe a, [[n]]) 

Returns the shortest distance between two nodes in a graph and a list of all possible paths from the ending node to the starting node.

The starting node is not included in each path.

shortestDistanceWith Source #

Arguments

:: (Foldable t, Hashable n, Ord a, Num a) 
=> (n -> t (n, a))

Function to generate neighbours

-> n

Start node

-> n

End node

-> Maybe a 

Given a function that takes a node and returns a sequence of (neighbour,edge weight) pairs, returns the shortest distance between two nodes.

shortestPathsWith Source #

Arguments

:: (Foldable t, Hashable n, Ord a, Num a) 
=> (n -> t (n, a))

Function to generate neighbours

-> n

Start node

-> n

End node

-> (Maybe a, [[n]]) 

Given a function that takes a node and returns a sequence of (neighbour,edge weight) pairs, returns the shortest distance between two nodes and a list of all possible paths from the ending node to the starting node.

The starting node is not included in each path.

Neighbour functions

neighbours4 :: (Num a, Num b) => (a, b) -> [(a, b)] Source #

Returns the 4 points orthogonally adjacent to the given point.

neighbours8 :: (Eq a, Eq b, Num a, Num b) => (a, b) -> [(a, b)] Source #

Returns the 8 points orthogonally or diagonally adjacent to the given point.

neighbours6 :: (Num a, Num b, Num c) => (a, b, c) -> [(a, b, c)] Source #

Returns the 6 points orthogonally adjacent to the given point in 3D space.

neighbours26 :: (Eq a, Eq b, Eq c, Num a, Num b, Num c) => (a, b, c) -> [(a, b, c)] Source #

Returns the 26 points orthogonally or diagonally adjacent to the given point in 3D space.

Taxicab (Manhattan) distance

taxicab2 :: Num a => (a, a) -> (a, a) -> a Source #

Returns the Taxicab/Manhattan distance between two points in 2D space.

taxicab3 :: Num a => (a, a, a) -> (a, a, a) -> a Source #

Returns the Taxicab/Manhattan distance between two points in 3D space.

taxicab :: Num a => [a] -> [a] -> a Source #

Returns the Taxicab/Manhattan distance between two points in n dimensions, where both points are lists of length n.

Input parsing

The following functions (beginning with "enumerate") operate on a grid of characters as a string with a newline after each row (as seen in several Advent of Code puzzle inputs).

enumerate' :: (Num y, Num x) => String -> [((x, y), Char)] Source #

Converts a grid to a list of pairs ((x,y),c) representing xy coordinates and the character at that location.

enumerateRead' :: (Read c, Num y, Num x) => String -> [((x, y), c)] Source #

Enumerates a grid along with reading the characters (usually as integers), and returns a list of pairs.

enumerate :: (Num y, Num x) => String -> [(x, y, Char)] Source #

Converts a grid to a list of triples (x,y,c) representing xy coordinates and the character at that location.

enumerateRead :: (Read c, Num y, Num x) => String -> [(x, y, c)] Source #

Enumerates a grid along with reading the characters (usually as integers), and returns a list of triples.

enumerateHM :: (Num x, Num y, Enum x, Enum y, Hashable x, Hashable y) => String -> HashMap (x, y) Char Source #

Enumerates a grid and stores it in a HashMap where points are mapped to the character at that location.

enumerateReadHM :: (Num x, Num y, Enum x, Enum y, Hashable x, Hashable y, Read c) => String -> HashMap (x, y) c Source #

Enumerates a grid and stores it in a HashMap along with reading the characters (usually as integers).

enumerateFilter :: (Num y, Num x) => (Char -> Bool) -> String -> [(x, y)] Source #

Returns a list of points on a grid for which a certain condition is met.

enumerateFilterSet :: (Ord x, Ord y, Num y, Num x) => (Char -> Bool) -> String -> Set (x, y) Source #

Returns a set of points on a grid for which a certain condition is met.

numbers :: (Num a, Read a) => String -> [a] Source #

Returns all the integers in a string (including negative signs).

numbers' :: (Num a, Read a) => String -> [a] Source #

Returns all the integers in a string (excluding negative signs).

binToDec :: Num a => [Bool] -> a Source #

Converts a list of booleans (parsed as a binary number) to an integer.

Flood fill

floodFill Source #

Arguments

:: Ord a 
=> (a -> [a])

Neighbour function

-> Set a

Initial set of points

-> Set a

Set of points to avoid

-> Set a 

Applies a flood fill algorithm given a function to generate a point's neighbours, a starting set of points, and a set of points to avoid. Returns a set of all points covered.

floodFillWith Source #

Arguments

:: Ord a 
=> (a -> a -> Bool)

Condition

-> (a -> [a])

Neighbour function

-> Set a

Initial set of points

-> Set a 

Applies a flood fill algorithm given a function to generate a point's neighbours, a condition that filters out points generated by said function, and a starting set of points. Returns a set of all points covered.

The condition is of the form a -> a -> Bool, which returns True if the second point is a valid neighbour of the first point and False otherwise.

List selection

choose :: (Num n, Ord n) => n -> [a] -> [[a]] Source #

Generates a list of all possible lists of length n by taking elements from the provided list of length l.

Relative order is maintained, and the length of the returned list is \(_{n}C_{l}\).

permute :: (Num n, Ord n) => n -> [a] -> [[a]] Source #

Generates a list of all possible lists of length n by taking elements from the provided list of length l.

The length of the returned list is \(_{n}P_{l}\).

takeEvery :: Int -> [a] -> [a] Source #

Takes every nth element from a list xs, starting from xs !! (n-1).

chunk :: Int -> [a] -> [[a]] Source #

Splits a list into sublists of size n. The length of the last sublist may be less than n.

Extrapolation

extrapolate :: (Integral b, Ord a) => b -> [a] -> a Source #

Gets the nth element of an infinite list, assuming that each element in the list can be generated using the previous element, for example, a list generated with iterate.

Debugging

prettyPrintSet :: (Enum b, Enum a, Ord a, Ord b) => Set (a, b) -> String Source #

Converts a set of points (x,y) to a string composed of # and ' '. This function is useful when displaying puzzle answers formed by a grid of points.

Up to translation of points, prettyPrintSet . enumerateFilterSet (=='#') = id.

prettyPrintSetWide :: (Enum b, Enum a, Ord a, Ord b) => Set (a, b) -> String Source #

Same as prettyPrintSet, but displays points at double width to improve readability.

prettyPrintHM :: (Enum b, Enum a, Hashable a, Hashable b, Ord a, Ord b) => HashMap (a, b) Char -> String Source #

Converts a HashMap of points (x,y) and characters c to a string with the corresponding character at each point. This function is useful when displaying puzzle answers formed by a grid of points.

Up to translation of points, prettyPrintHM . enumerateHM = id.

prettyPrintHMWide :: (Enum b, Enum a, Hashable a, Hashable b, Ord a, Ord b) => HashMap (a, b) Char -> String Source #

Same as prettyPrintHM, but displays points at double width to improve readability.

traceSleep :: Int -> a -> a Source #

Pauses execution for n microseconds, before returning the second argument as its result. Useful for slowing down output that normally floods the terminal.

Like functions exported by Debug.Trace, this function should only be used for debugging.

The function is not referentially transparent: its type indicates that it is a pure function but it has the side effect of delaying execution.

traceSleepSeconds :: Int -> a -> a Source #

Pauses execution for n seconds. See traceSleep.

Memoization

Memoize a function with multiple arguments. Uses memo from Data.MemoUgly with slight modifications.

memo2 :: (Ord a, Ord b) => (a -> b -> c) -> a -> b -> c Source #

memo3 :: (Ord a, Ord b, Ord c) => (a -> b -> c -> d) -> a -> b -> c -> d Source #

memo4 :: (Ord a, Ord b, Ord c, Ord d) => (a -> b -> c -> d -> e) -> a -> b -> c -> d -> e Source #

Range operations

range :: (Ord a, Enum a) => a -> a -> [a] Source #

Generates a range with [x..y], but reverses the list instead of returning an empty range if x > y.

rangeIntersect :: Ord b => (b, b) -> (b, b) -> Maybe (b, b) Source #

Takes (a,b) and (c,d) as arguments and returns the intersection of the ranges [a..b] and [c..d] as another pair if it is not empty.

rangeSubtract :: (Ord a, Num a) => (a, a) -> (a, a) -> [(a, a)] Source #

Takes (a,b) and (c,d) as arguments and returns every element in [c..d] that is not in [a..b] as a list of pairs of length at most 2.

ComplexL1 datatype

data ComplexL1 a Source #

A Complex number type whose instance requires the constituent type to only be part of Num instead of RealFloat.

As a consequence of this, the abs and magnitude functions use the L1 metric instead of the L2 metric (which is quite useful for Advent of Code puzzles).

Also, signum is performed element-wise and can only return one of 8 different values.

This breaks the equality abs z * signum z == z that is true in the Complex datatype.

The functions mkPolar, cis, polar and phase are unimplemented for obvious reasons.

Unlike Complex, Ord and Hashable are supported. The Ord instance treats the values as tuples.

The name of the datatype contains "L1" in order to reflect these changes.

Constructors

a :+ a infix 6 

Instances

Instances details
MonadFix ComplexL1 Source # 
Instance details

Defined in Utility.AOC

Methods

mfix :: (a -> ComplexL1 a) -> ComplexL1 a #

MonadZip ComplexL1 Source # 
Instance details

Defined in Utility.AOC

Methods

mzip :: ComplexL1 a -> ComplexL1 b -> ComplexL1 (a, b) #

mzipWith :: (a -> b -> c) -> ComplexL1 a -> ComplexL1 b -> ComplexL1 c #

munzip :: ComplexL1 (a, b) -> (ComplexL1 a, ComplexL1 b) #

Foldable ComplexL1 Source # 
Instance details

Defined in Utility.AOC

Methods

fold :: Monoid m => ComplexL1 m -> m #

foldMap :: Monoid m => (a -> m) -> ComplexL1 a -> m #

foldMap' :: Monoid m => (a -> m) -> ComplexL1 a -> m #

foldr :: (a -> b -> b) -> b -> ComplexL1 a -> b #

foldr' :: (a -> b -> b) -> b -> ComplexL1 a -> b #

foldl :: (b -> a -> b) -> b -> ComplexL1 a -> b #

foldl' :: (b -> a -> b) -> b -> ComplexL1 a -> b #

foldr1 :: (a -> a -> a) -> ComplexL1 a -> a #

foldl1 :: (a -> a -> a) -> ComplexL1 a -> a #

toList :: ComplexL1 a -> [a] #

null :: ComplexL1 a -> Bool #

length :: ComplexL1 a -> Int #

elem :: Eq a => a -> ComplexL1 a -> Bool #

maximum :: Ord a => ComplexL1 a -> a #

minimum :: Ord a => ComplexL1 a -> a #

sum :: Num a => ComplexL1 a -> a #

product :: Num a => ComplexL1 a -> a #

Traversable ComplexL1 Source # 
Instance details

Defined in Utility.AOC

Methods

traverse :: Applicative f => (a -> f b) -> ComplexL1 a -> f (ComplexL1 b) #

sequenceA :: Applicative f => ComplexL1 (f a) -> f (ComplexL1 a) #

mapM :: Monad m => (a -> m b) -> ComplexL1 a -> m (ComplexL1 b) #

sequence :: Monad m => ComplexL1 (m a) -> m (ComplexL1 a) #

Applicative ComplexL1 Source # 
Instance details

Defined in Utility.AOC

Methods

pure :: a -> ComplexL1 a #

(<*>) :: ComplexL1 (a -> b) -> ComplexL1 a -> ComplexL1 b #

liftA2 :: (a -> b -> c) -> ComplexL1 a -> ComplexL1 b -> ComplexL1 c #

(*>) :: ComplexL1 a -> ComplexL1 b -> ComplexL1 b #

(<*) :: ComplexL1 a -> ComplexL1 b -> ComplexL1 a #

Functor ComplexL1 Source # 
Instance details

Defined in Utility.AOC

Methods

fmap :: (a -> b) -> ComplexL1 a -> ComplexL1 b #

(<$) :: a -> ComplexL1 b -> ComplexL1 a #

Monad ComplexL1 Source # 
Instance details

Defined in Utility.AOC

Methods

(>>=) :: ComplexL1 a -> (a -> ComplexL1 b) -> ComplexL1 b #

(>>) :: ComplexL1 a -> ComplexL1 b -> ComplexL1 b #

return :: a -> ComplexL1 a #

Generic1 ComplexL1 Source # 
Instance details

Defined in Utility.AOC

Associated Types

type Rep1 ComplexL1 :: k -> Type #

Methods

from1 :: forall (a :: k). ComplexL1 a -> Rep1 ComplexL1 a #

to1 :: forall (a :: k). Rep1 ComplexL1 a -> ComplexL1 a #

Data a => Data (ComplexL1 a) Source # 
Instance details

Defined in Utility.AOC

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ComplexL1 a -> c (ComplexL1 a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ComplexL1 a) #

toConstr :: ComplexL1 a -> Constr #

dataTypeOf :: ComplexL1 a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (ComplexL1 a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ComplexL1 a)) #

gmapT :: (forall b. Data b => b -> b) -> ComplexL1 a -> ComplexL1 a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ComplexL1 a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ComplexL1 a -> r #

gmapQ :: (forall d. Data d => d -> u) -> ComplexL1 a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ComplexL1 a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ComplexL1 a -> m (ComplexL1 a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ComplexL1 a -> m (ComplexL1 a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ComplexL1 a -> m (ComplexL1 a) #

Storable a => Storable (ComplexL1 a) Source # 
Instance details

Defined in Utility.AOC

Methods

sizeOf :: ComplexL1 a -> Int #

alignment :: ComplexL1 a -> Int #

peekElemOff :: Ptr (ComplexL1 a) -> Int -> IO (ComplexL1 a) #

pokeElemOff :: Ptr (ComplexL1 a) -> Int -> ComplexL1 a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (ComplexL1 a) #

pokeByteOff :: Ptr b -> Int -> ComplexL1 a -> IO () #

peek :: Ptr (ComplexL1 a) -> IO (ComplexL1 a) #

poke :: Ptr (ComplexL1 a) -> ComplexL1 a -> IO () #

Generic (ComplexL1 a) Source # 
Instance details

Defined in Utility.AOC

Associated Types

type Rep (ComplexL1 a) :: Type -> Type #

Methods

from :: ComplexL1 a -> Rep (ComplexL1 a) x #

to :: Rep (ComplexL1 a) x -> ComplexL1 a #

Num a => Num (ComplexL1 a) Source # 
Instance details

Defined in Utility.AOC

Read a => Read (ComplexL1 a) Source # 
Instance details

Defined in Utility.AOC

Show a => Show (ComplexL1 a) Source # 
Instance details

Defined in Utility.AOC

Eq a => Eq (ComplexL1 a) Source # 
Instance details

Defined in Utility.AOC

Methods

(==) :: ComplexL1 a -> ComplexL1 a -> Bool #

(/=) :: ComplexL1 a -> ComplexL1 a -> Bool #

Ord a => Ord (ComplexL1 a) Source # 
Instance details

Defined in Utility.AOC

Hashable a => Hashable (ComplexL1 a) Source # 
Instance details

Defined in Utility.AOC

Methods

hashWithSalt :: Int -> ComplexL1 a -> Int #

hash :: ComplexL1 a -> Int #

type Rep1 ComplexL1 Source # 
Instance details

Defined in Utility.AOC

type Rep (ComplexL1 a) Source # 
Instance details

Defined in Utility.AOC

realPart :: ComplexL1 a -> a Source #

Real part of a complex number.

imagPart :: ComplexL1 a -> a Source #

Imaginary part of a complex number.

conjugate :: Num a => ComplexL1 a -> ComplexL1 a Source #

Conjugate of a complex number.

magnitude :: Num a => ComplexL1 a -> a Source #

(Taxicab) magnitude of a complex number.

Visualization

displayPoints :: Integral a => [(a, a)] -> IO () Source #

Displays a list of points in an external window.

displayPolygon :: Integral a => [(a, a)] -> IO () Source #

Displays a polygon in an external window. The last point in the list of points is not joined to the first point.

displayPolygons :: Integral a => [[(a, a)]] -> IO () Source #

Displays a list of polygons in an external window. The last point in each list of points is not joined to the first point.

displayGraphDirected :: (Hashable n, Foldable t) => HashMap n (t n) -> IO () Source #

Displays a directed graph in an external window.

displayGraphUndirected :: (Hashable n, Foldable t) => HashMap n (t n) -> IO () Source #

Displays an undirected graph in an external window.

The graph is a HashMap mapping each node to a sequence of neighbours.

It is assumed that any neighbour that a node in the graph points to is also in the graph.

Note that this function and displayGraphDirected can be taxing on lower-end devices for well-connected graphs with more than a few hundred nodes.

class Eq a => Hashable a #

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

Instances

Instances details
Hashable ByteArray

This instance was available since 1.4.1.0 only for GHC-9.4+

Since: hashable-1.4.2.0

Instance details

Defined in Data.Hashable.Class

Hashable SomeTypeRep 
Instance details

Defined in Data.Hashable.Class

Hashable Unique 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Unique -> Int #

hash :: Unique -> Int #

Hashable Version 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Version -> Int #

hash :: Version -> Int #

Hashable IntPtr 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> IntPtr -> Int #

hash :: IntPtr -> Int #

Hashable WordPtr 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> WordPtr -> Int #

hash :: WordPtr -> Int #

Hashable Void 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Void -> Int #

hash :: Void -> Int #

Hashable ThreadId 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> ThreadId -> Int #

hash :: ThreadId -> Int #

Hashable Fingerprint

Since: hashable-1.3.0.0

Instance details

Defined in Data.Hashable.Class

Hashable Int16 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Int16 -> Int #

hash :: Int16 -> Int #

Hashable Int32 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Int32 -> Int #

hash :: Int32 -> Int #

Hashable Int64 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Int64 -> Int #

hash :: Int64 -> Int #

Hashable Int8 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Int8 -> Int #

hash :: Int8 -> Int #

Hashable Word16 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Word16 -> Int #

hash :: Word16 -> Int #

Hashable Word32 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Word32 -> Int #

hash :: Word32 -> Int #

Hashable Word64 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Word64 -> Int #

hash :: Word64 -> Int #

Hashable Word8 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Word8 -> Int #

hash :: Word8 -> Int #

Hashable ByteString 
Instance details

Defined in Data.Hashable.Class

Hashable ByteString 
Instance details

Defined in Data.Hashable.Class

Hashable ShortByteString 
Instance details

Defined in Data.Hashable.Class

Hashable IntSet

Since: hashable-1.3.4.0

Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> IntSet -> Int #

hash :: IntSet -> Int #

Hashable OsString 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> OsString -> Int #

hash :: OsString -> Int #

Hashable PosixString 
Instance details

Defined in Data.Hashable.Class

Hashable WindowsString 
Instance details

Defined in Data.Hashable.Class

Hashable BigNat 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> BigNat -> Int #

hash :: BigNat -> Int #

Hashable Ordering 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Ordering -> Int #

hash :: Ordering -> Int #

Hashable OsString

Since: hashable-1.4.2.0

Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> OsString -> Int #

hash :: OsString -> Int #

Hashable PosixString

Since: hashable-1.4.2.0

Instance details

Defined in Data.Hashable.Class

Hashable WindowsString

Since: hashable-1.4.2.0

Instance details

Defined in Data.Hashable.Class

Hashable Text 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Text -> Int #

hash :: Text -> Int #

Hashable Text 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Text -> Int #

hash :: Text -> Int #

Hashable Integer 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Integer -> Int #

hash :: Integer -> Int #

Hashable Natural 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Natural -> Int #

hash :: Natural -> Int #

Hashable () 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> () -> Int #

hash :: () -> Int #

Hashable Bool 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Bool -> Int #

hash :: Bool -> Int #

Hashable Char 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Char -> Int #

hash :: Char -> Int #

Hashable Double

Note: prior to hashable-1.3.0.0, hash 0.0 /= hash (-0.0)

The hash of NaN is not well defined.

Since: hashable-1.3.0.0

Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Double -> Int #

hash :: Double -> Int #

Hashable Float

Note: prior to hashable-1.3.0.0, hash 0.0 /= hash (-0.0)

The hash of NaN is not well defined.

Since: hashable-1.3.0.0

Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Float -> Int #

hash :: Float -> Int #

Hashable Int 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Int -> Int #

hash :: Int -> Int #

Hashable Word 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Word -> Int #

hash :: Word -> Int #

Hashable a => Hashable (ComplexL1 a) Source # 
Instance details

Defined in Utility.AOC

Methods

hashWithSalt :: Int -> ComplexL1 a -> Int #

hash :: ComplexL1 a -> Int #

Hashable a => Hashable (Complex a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Complex a -> Int #

hash :: Complex a -> Int #

Hashable a => Hashable (Identity a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Identity a -> Int #

hash :: Identity a -> Int #

Hashable a => Hashable (First a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> First a -> Int #

hash :: First a -> Int #

Hashable a => Hashable (Last a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Last a -> Int #

hash :: Last a -> Int #

Hashable a => Hashable (Max a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Max a -> Int #

hash :: Max a -> Int #

Hashable a => Hashable (Min a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Min a -> Int #

hash :: Min a -> Int #

Hashable a => Hashable (WrappedMonoid a) 
Instance details

Defined in Data.Hashable.Class

Hashable a => Hashable (NonEmpty a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> NonEmpty a -> Int #

hash :: NonEmpty a -> Int #

Hashable (FunPtr a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> FunPtr a -> Int #

hash :: FunPtr a -> Int #

Hashable (Ptr a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Ptr a -> Int #

hash :: Ptr a -> Int #

Hashable a => Hashable (Ratio a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Ratio a -> Int #

hash :: Ratio a -> Int #

Hashable (StableName a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> StableName a -> Int #

hash :: StableName a -> Int #

Hashable v => Hashable (IntMap v)

Since: hashable-1.3.4.0

Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> IntMap v -> Int #

hash :: IntMap v -> Int #

Hashable v => Hashable (Seq v)

Since: hashable-1.3.4.0

Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Seq v -> Int #

hash :: Seq v -> Int #

Hashable v => Hashable (Set v)

Since: hashable-1.3.4.0

Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Set v -> Int #

hash :: Set v -> Int #

Hashable v => Hashable (Tree v)

Since: hashable-1.3.4.0

Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Tree v -> Int #

hash :: Tree v -> Int #

Eq a => Hashable (Hashed a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Hashed a -> Int #

hash :: Hashed a -> Int #

Hashable a => Hashable (Plucker a) 
Instance details

Defined in Linear.Plucker

Methods

hashWithSalt :: Int -> Plucker a -> Int #

hash :: Plucker a -> Int #

Hashable a => Hashable (Quaternion a) 
Instance details

Defined in Linear.Quaternion

Methods

hashWithSalt :: Int -> Quaternion a -> Int #

hash :: Quaternion a -> Int #

Hashable (V0 a) 
Instance details

Defined in Linear.V0

Methods

hashWithSalt :: Int -> V0 a -> Int #

hash :: V0 a -> Int #

Hashable a => Hashable (V1 a) 
Instance details

Defined in Linear.V1

Methods

hashWithSalt :: Int -> V1 a -> Int #

hash :: V1 a -> Int #

Hashable a => Hashable (V2 a) 
Instance details

Defined in Linear.V2

Methods

hashWithSalt :: Int -> V2 a -> Int #

hash :: V2 a -> Int #

Hashable a => Hashable (V3 a) 
Instance details

Defined in Linear.V3

Methods

hashWithSalt :: Int -> V3 a -> Int #

hash :: V3 a -> Int #

Hashable a => Hashable (V4 a) 
Instance details

Defined in Linear.V4

Methods

hashWithSalt :: Int -> V4 a -> Int #

hash :: V4 a -> Int #

Hashable a => Hashable (Maybe a) 
Instance details

Defined in Data.Strict.Maybe

Methods

hashWithSalt :: Int -> Maybe a -> Int #

hash :: Maybe a -> Int #

Hashable a => Hashable (HashSet a) 
Instance details

Defined in Data.HashSet.Internal

Methods

hashWithSalt :: Int -> HashSet a -> Int #

hash :: HashSet a -> Int #

Hashable a => Hashable (Maybe a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Maybe a -> Int #

hash :: Maybe a -> Int #

Hashable a => Hashable (a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> (a) -> Int #

hash :: (a) -> Int #

Hashable a => Hashable [a] 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> [a] -> Int #

hash :: [a] -> Int #

(Hashable a, Hashable b) => Hashable (Either a b) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Either a b -> Int #

hash :: Either a b -> Int #

Hashable (Fixed a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Fixed a -> Int #

hash :: Fixed a -> Int #

Hashable (Proxy a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Proxy a -> Int #

hash :: Proxy a -> Int #

Hashable a => Hashable (Arg a b)

Note: Prior to hashable-1.3.0.0 the hash computation included the second argument of Arg which wasn't consistent with its Eq instance.

Since hashable-1.5.0.0, hash (Semi.arg a _) = hash a

Since: hashable-1.3.0.0

Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Arg a b -> Int #

hash :: Arg a b -> Int #

Hashable (TypeRep a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> TypeRep a -> Int #

hash :: TypeRep a -> Int #

(Hashable k, Hashable v) => Hashable (Map k v)

Since: hashable-1.3.4.0

Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Map k v -> Int #

hash :: Map k v -> Int #

Hashable (f a) => Hashable (Point f a) 
Instance details

Defined in Linear.Affine

Methods

hashWithSalt :: Int -> Point f a -> Int #

hash :: Point f a -> Int #

(Hashable a, Hashable b) => Hashable (Either a b) 
Instance details

Defined in Data.Strict.Either

Methods

hashWithSalt :: Int -> Either a b -> Int #

hash :: Either a b -> Int #

(Hashable a, Hashable b) => Hashable (These a b) 
Instance details

Defined in Data.Strict.These

Methods

hashWithSalt :: Int -> These a b -> Int #

hash :: These a b -> Int #

(Hashable a, Hashable b) => Hashable (Pair a b) 
Instance details

Defined in Data.Strict.Tuple

Methods

hashWithSalt :: Int -> Pair a b -> Int #

hash :: Pair a b -> Int #

(Hashable a, Hashable b) => Hashable (These a b) 
Instance details

Defined in Data.These

Methods

hashWithSalt :: Int -> These a b -> Int #

hash :: These a b -> Int #

(Hashable k, Hashable v) => Hashable (HashMap k v) 
Instance details

Defined in Data.HashMap.Internal

Methods

hashWithSalt :: Int -> HashMap k v -> Int #

hash :: HashMap k v -> Int #

(Hashable a1, Hashable a2) => Hashable (a1, a2) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> (a1, a2) -> Int #

hash :: (a1, a2) -> Int #

Hashable a => Hashable (Const a b) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Const a b -> Int #

hash :: Const a b -> Int #

Hashable a => Hashable (V n a) 
Instance details

Defined in Linear.V

Methods

hashWithSalt :: Int -> V n a -> Int #

hash :: V n a -> Int #

(Hashable a1, Hashable a2, Hashable a3) => Hashable (a1, a2, a3) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> (a1, a2, a3) -> Int #

hash :: (a1, a2, a3) -> Int #

(Hashable (f a), Hashable (g a)) => Hashable (Product f g a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Product f g a -> Int #

hash :: Product f g a -> Int #

(Hashable (f a), Hashable (g a)) => Hashable (Sum f g a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Sum f g a -> Int #

hash :: Sum f g a -> Int #

(Hashable a1, Hashable a2, Hashable a3, Hashable a4) => Hashable (a1, a2, a3, a4) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> (a1, a2, a3, a4) -> Int #

hash :: (a1, a2, a3, a4) -> Int #

Hashable (f (g a)) => Hashable (Compose f g a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Compose f g a -> Int #

hash :: Compose f g a -> Int #

(Hashable a1, Hashable a2, Hashable a3, Hashable a4, Hashable a5) => Hashable (a1, a2, a3, a4, a5) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> (a1, a2, a3, a4, a5) -> Int #

hash :: (a1, a2, a3, a4, a5) -> Int #

(Hashable a1, Hashable a2, Hashable a3, Hashable a4, Hashable a5, Hashable a6) => Hashable (a1, a2, a3, a4, a5, a6) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> (a1, a2, a3, a4, a5, a6) -> Int #

hash :: (a1, a2, a3, a4, a5, a6) -> Int #

(Hashable a1, Hashable a2, Hashable a3, Hashable a4, Hashable a5, Hashable a6, Hashable a7) => Hashable (a1, a2, a3, a4, a5, a6, a7) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> (a1, a2, a3, a4, a5, a6, a7) -> Int #

hash :: (a1, a2, a3, a4, a5, a6, a7) -> Int #

data HashMap k v #

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

Instances

Instances details
Bifoldable HashMap

Since: unordered-containers-0.2.11

Instance details

Defined in Data.HashMap.Internal

Methods

bifold :: Monoid m => HashMap m m -> m #

bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> HashMap a b -> m #

bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> HashMap a b -> c #

bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> HashMap a b -> c #

Eq2 HashMap 
Instance details

Defined in Data.HashMap.Internal

Methods

liftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> HashMap a c -> HashMap b d -> Bool #

Ord2 HashMap 
Instance details

Defined in Data.HashMap.Internal

Methods

liftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) -> HashMap a c -> HashMap b d -> Ordering #

Show2 HashMap 
Instance details

Defined in Data.HashMap.Internal

Methods

liftShowsPrec2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> HashMap a b -> ShowS #

liftShowList2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> [HashMap a b] -> ShowS #

NFData2 HashMap

Since: unordered-containers-0.2.14.0

Instance details

Defined in Data.HashMap.Internal

Methods

liftRnf2 :: (a -> ()) -> (b -> ()) -> HashMap a b -> () #

Hashable2 HashMap 
Instance details

Defined in Data.HashMap.Internal

Methods

liftHashWithSalt2 :: (Int -> a -> Int) -> (Int -> b -> Int) -> Int -> HashMap a b -> Int #

(Lift k, Lift v) => Lift (HashMap k v :: Type)

Since: unordered-containers-0.2.17.0

Instance details

Defined in Data.HashMap.Internal

Methods

lift :: Quote m => HashMap k v -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => HashMap k v -> Code m (HashMap k v) #

Foldable (HashMap k) 
Instance details

Defined in Data.HashMap.Internal

Methods

fold :: Monoid m => HashMap k m -> m #

foldMap :: Monoid m => (a -> m) -> HashMap k a -> m #

foldMap' :: Monoid m => (a -> m) -> HashMap k a -> m #

foldr :: (a -> b -> b) -> b -> HashMap k a -> b #

foldr' :: (a -> b -> b) -> b -> HashMap k a -> b #

foldl :: (b -> a -> b) -> b -> HashMap k a -> b #

foldl' :: (b -> a -> b) -> b -> HashMap k a -> b #

foldr1 :: (a -> a -> a) -> HashMap k a -> a #

foldl1 :: (a -> a -> a) -> HashMap k a -> a #

toList :: HashMap k a -> [a] #

null :: HashMap k a -> Bool #

length :: HashMap k a -> Int #

elem :: Eq a => a -> HashMap k a -> Bool #

maximum :: Ord a => HashMap k a -> a #

minimum :: Ord a => HashMap k a -> a #

sum :: Num a => HashMap k a -> a #

product :: Num a => HashMap k a -> a #

Eq k => Eq1 (HashMap k) 
Instance details

Defined in Data.HashMap.Internal

Methods

liftEq :: (a -> b -> Bool) -> HashMap k a -> HashMap k b -> Bool #

Ord k => Ord1 (HashMap k) 
Instance details

Defined in Data.HashMap.Internal

Methods

liftCompare :: (a -> b -> Ordering) -> HashMap k a -> HashMap k b -> Ordering #

(Hashable k, Read k) => Read1 (HashMap k) 
Instance details

Defined in Data.HashMap.Internal

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (HashMap k a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [HashMap k a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (HashMap k a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [HashMap k a] #

Show k => Show1 (HashMap k) 
Instance details

Defined in Data.HashMap.Internal

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> HashMap k a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [HashMap k a] -> ShowS #

Traversable (HashMap k) 
Instance details

Defined in Data.HashMap.Internal

Methods

traverse :: Applicative f => (a -> f b) -> HashMap k a -> f (HashMap k b) #

sequenceA :: Applicative f => HashMap k (f a) -> f (HashMap k a) #

mapM :: Monad m => (a -> m b) -> HashMap k a -> m (HashMap k b) #

sequence :: Monad m => HashMap k (m a) -> m (HashMap k a) #

Functor (HashMap k) 
Instance details

Defined in Data.HashMap.Internal

Methods

fmap :: (a -> b) -> HashMap k a -> HashMap k b #

(<$) :: a -> HashMap k b -> HashMap k a #

NFData k => NFData1 (HashMap k)

Since: unordered-containers-0.2.14.0

Instance details

Defined in Data.HashMap.Internal

Methods

liftRnf :: (a -> ()) -> HashMap k a -> () #

Hashable k => Hashable1 (HashMap k) 
Instance details

Defined in Data.HashMap.Internal

Methods

liftHashWithSalt :: (Int -> a -> Int) -> Int -> HashMap k a -> Int #

(Eq k, Hashable k) => Affine (HashMap k) 
Instance details

Defined in Linear.Affine

Associated Types

type Diff (HashMap k) :: Type -> Type #

Methods

(.-.) :: Num a => HashMap k a -> HashMap k a -> Diff (HashMap k) a #

(.+^) :: Num a => HashMap k a -> Diff (HashMap k) a -> HashMap k a #

(.-^) :: Num a => HashMap k a -> Diff (HashMap k) a -> HashMap k a #

(Hashable k, Eq k) => Metric (HashMap k) 
Instance details

Defined in Linear.Metric

Methods

dot :: Num a => HashMap k a -> HashMap k a -> a #

quadrance :: Num a => HashMap k a -> a #

qd :: Num a => HashMap k a -> HashMap k a -> a #

distance :: Floating a => HashMap k a -> HashMap k a -> a #

norm :: Floating a => HashMap k a -> a #

signorm :: Floating a => HashMap k a -> HashMap k a #

(Eq k, Hashable k) => Trace (HashMap k) 
Instance details

Defined in Linear.Trace

Methods

trace :: Num a => HashMap k (HashMap k a) -> a #

diagonal :: HashMap k (HashMap k a) -> HashMap k a #

(Eq k, Hashable k) => Additive (HashMap k) 
Instance details

Defined in Linear.Vector

Methods

zero :: Num a => HashMap k a #

(^+^) :: Num a => HashMap k a -> HashMap k a -> HashMap k a #

(^-^) :: Num a => HashMap k a -> HashMap k a -> HashMap k a #

lerp :: Num a => a -> HashMap k a -> HashMap k a -> HashMap k a #

liftU2 :: (a -> a -> a) -> HashMap k a -> HashMap k a -> HashMap k a #

liftI2 :: (a -> b -> c) -> HashMap k a -> HashMap k b -> HashMap k c #

(Data k, Data v, Hashable k) => Data (HashMap k v) 
Instance details

Defined in Data.HashMap.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HashMap k v -> c (HashMap k v) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HashMap k v) #

toConstr :: HashMap k v -> Constr #

dataTypeOf :: HashMap k v -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HashMap k v)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HashMap k v)) #

gmapT :: (forall b. Data b => b -> b) -> HashMap k v -> HashMap k v #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HashMap k v -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HashMap k v -> r #

gmapQ :: (forall d. Data d => d -> u) -> HashMap k v -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> HashMap k v -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> HashMap k v -> m (HashMap k v) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HashMap k v -> m (HashMap k v) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HashMap k v -> m (HashMap k v) #

Hashable k => Monoid (HashMap k v)

mempty = empty

mappend = union

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

Examples

Expand
>>> mappend (fromList [(1,'a'),(2,'b')]) (fromList [(2,'c'),(3,'d')])
fromList [(1,'a'),(2,'b'),(3,'d')]
Instance details

Defined in Data.HashMap.Internal

Methods

mempty :: HashMap k v #

mappend :: HashMap k v -> HashMap k v -> HashMap k v #

mconcat :: [HashMap k v] -> HashMap k v #

Hashable k => Semigroup (HashMap k v)

<> = union

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

Examples

Expand
>>> fromList [(1,'a'),(2,'b')] <> fromList [(2,'c'),(3,'d')]
fromList [(1,'a'),(2,'b'),(3,'d')]
Instance details

Defined in Data.HashMap.Internal

Methods

(<>) :: HashMap k v -> HashMap k v -> HashMap k v #

sconcat :: NonEmpty (HashMap k v) -> HashMap k v #

stimes :: Integral b => b -> HashMap k v -> HashMap k v #

Hashable k => IsList (HashMap k v) 
Instance details

Defined in Data.HashMap.Internal

Associated Types

type Item (HashMap k v) #

Methods

fromList :: [Item (HashMap k v)] -> HashMap k v #

fromListN :: Int -> [Item (HashMap k v)] -> HashMap k v #

toList :: HashMap k v -> [Item (HashMap k v)] #

(Hashable k, Read k, Read e) => Read (HashMap k e) 
Instance details

Defined in Data.HashMap.Internal

(Show k, Show v) => Show (HashMap k v) 
Instance details

Defined in Data.HashMap.Internal

Methods

showsPrec :: Int -> HashMap k v -> ShowS #

show :: HashMap k v -> String #

showList :: [HashMap k v] -> ShowS #

(NFData k, NFData v) => NFData (HashMap k v) 
Instance details

Defined in Data.HashMap.Internal

Methods

rnf :: HashMap k v -> () #

(Eq k, Eq v) => Eq (HashMap k v)

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

>>> data D = A | B deriving (Eq, Show)
>>> instance Hashable D where hashWithSalt salt _d = salt
>>> x = fromList [(A,1), (B,2)]
>>> y = fromList [(B,2), (A,1)]
>>> x == y
True
>>> toList 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.

Instance details

Defined in Data.HashMap.Internal

Methods

(==) :: HashMap k v -> HashMap k v -> Bool #

(/=) :: HashMap k v -> HashMap k v -> Bool #

(Ord k, Ord v) => Ord (HashMap k v)

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.

Instance details

Defined in Data.HashMap.Internal

Methods

compare :: HashMap k v -> HashMap k v -> Ordering #

(<) :: HashMap k v -> HashMap k v -> Bool #

(<=) :: HashMap k v -> HashMap k v -> Bool #

(>) :: HashMap k v -> HashMap k v -> Bool #

(>=) :: HashMap k v -> HashMap k v -> Bool #

max :: HashMap k v -> HashMap k v -> HashMap k v #

min :: HashMap k v -> HashMap k v -> HashMap k v #

(Hashable k, Hashable v) => Hashable (HashMap k v) 
Instance details

Defined in Data.HashMap.Internal

Methods

hashWithSalt :: Int -> HashMap k v -> Int #

hash :: HashMap k v -> Int #

(Eq k, Hashable k) => At (HashMap k a) 
Instance details

Defined in Control.Lens.At

Methods

at :: Index (HashMap k a) -> Lens' (HashMap k a) (Maybe (IxValue (HashMap k a))) #

(Eq k, Hashable k) => Ixed (HashMap k a) 
Instance details

Defined in Control.Lens.At

Methods

ix :: Index (HashMap k a) -> Traversal' (HashMap k a) (IxValue (HashMap k a)) #

(Hashable k, Eq k) => Wrapped (HashMap k a) 
Instance details

Defined in Control.Lens.Wrapped

Associated Types

type Unwrapped (HashMap k a) #

Methods

_Wrapped' :: Iso' (HashMap k a) (Unwrapped (HashMap k a)) #

(t ~ HashMap k' a', Hashable k, Eq k) => Rewrapped (HashMap k a) t

Use _Wrapping fromList. Unwrapping returns some permutation of the list.

Instance details

Defined in Control.Lens.Wrapped

type Diff (HashMap k) 
Instance details

Defined in Linear.Affine

type Diff (HashMap k) = HashMap k
type Item (HashMap k v) 
Instance details

Defined in Data.HashMap.Internal

type Item (HashMap k v) = (k, v)
type Index (HashMap k a) 
Instance details

Defined in Control.Lens.At

type Index (HashMap k a) = k
type IxValue (HashMap k a) 
Instance details

Defined in Control.Lens.At

type IxValue (HashMap k a) = a
type Unwrapped (HashMap k a) 
Instance details

Defined in Control.Lens.Wrapped

type Unwrapped (HashMap k a) = [(k, a)]

data Set a #

A set of values a.

Instances

Instances details
Foldable Set

Folds in order of increasing key.

Instance details

Defined in Data.Set.Internal

Methods

fold :: Monoid m => Set m -> m #

foldMap :: Monoid m => (a -> m) -> Set a -> m #

foldMap' :: Monoid m => (a -> m) -> Set a -> m #

foldr :: (a -> b -> b) -> b -> Set a -> b #

foldr' :: (a -> b -> b) -> b -> Set a -> b #

foldl :: (b -> a -> b) -> b -> Set a -> b #

foldl' :: (b -> a -> b) -> b -> Set a -> b #

foldr1 :: (a -> a -> a) -> Set a -> a #

foldl1 :: (a -> a -> a) -> Set a -> a #

toList :: Set a -> [a] #

null :: Set a -> Bool #

length :: Set a -> Int #

elem :: Eq a => a -> Set a -> Bool #

maximum :: Ord a => Set a -> a #

minimum :: Ord a => Set a -> a #

sum :: Num a => Set a -> a #

product :: Num a => Set a -> a #

Eq1 Set

Since: containers-0.5.9

Instance details

Defined in Data.Set.Internal

Methods

liftEq :: (a -> b -> Bool) -> Set a -> Set b -> Bool #

Ord1 Set

Since: containers-0.5.9

Instance details

Defined in Data.Set.Internal

Methods

liftCompare :: (a -> b -> Ordering) -> Set a -> Set b -> Ordering #

Show1 Set

Since: containers-0.5.9

Instance details

Defined in Data.Set.Internal

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Set a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Set a] -> ShowS #

Hashable1 Set

Since: hashable-1.3.4.0

Instance details

Defined in Data.Hashable.Class

Methods

liftHashWithSalt :: (Int -> a -> Int) -> Int -> Set a -> Int #

Lift a => Lift (Set a :: Type)

Since: containers-0.6.6

Instance details

Defined in Data.Set.Internal

Methods

lift :: Quote m => Set a -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => Set a -> Code m (Set a) #

(Data a, Ord a) => Data (Set a) 
Instance details

Defined in Data.Set.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Set a -> c (Set a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Set a) #

toConstr :: Set a -> Constr #

dataTypeOf :: Set a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Set a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Set a)) #

gmapT :: (forall b. Data b => b -> b) -> Set a -> Set a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Set a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Set a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Set a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Set a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Set a -> m (Set a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Set a -> m (Set a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Set a -> m (Set a) #

Ord a => Monoid (Set a) 
Instance details

Defined in Data.Set.Internal

Methods

mempty :: Set a #

mappend :: Set a -> Set a -> Set a #

mconcat :: [Set a] -> Set a #

Ord a => Semigroup (Set a)

Since: containers-0.5.7

Instance details

Defined in Data.Set.Internal

Methods

(<>) :: Set a -> Set a -> Set a #

sconcat :: NonEmpty (Set a) -> Set a #

stimes :: Integral b => b -> Set a -> Set a #

Ord a => IsList (Set a)

Since: containers-0.5.6.2

Instance details

Defined in Data.Set.Internal

Associated Types

type Item (Set a) #

Methods

fromList :: [Item (Set a)] -> Set a #

fromListN :: Int -> [Item (Set a)] -> Set a #

toList :: Set a -> [Item (Set a)] #

(Read a, Ord a) => Read (Set a) 
Instance details

Defined in Data.Set.Internal

Show a => Show (Set a) 
Instance details

Defined in Data.Set.Internal

Methods

showsPrec :: Int -> Set a -> ShowS #

show :: Set a -> String #

showList :: [Set a] -> ShowS #

NFData a => NFData (Set a) 
Instance details

Defined in Data.Set.Internal

Methods

rnf :: Set a -> () #

Eq a => Eq (Set a) 
Instance details

Defined in Data.Set.Internal

Methods

(==) :: Set a -> Set a -> Bool #

(/=) :: Set a -> Set a -> Bool #

Ord a => Ord (Set a) 
Instance details

Defined in Data.Set.Internal

Methods

compare :: Set a -> Set a -> Ordering #

(<) :: Set a -> Set a -> Bool #

(<=) :: Set a -> Set a -> Bool #

(>) :: Set a -> Set a -> Bool #

(>=) :: Set a -> Set a -> Bool #

max :: Set a -> Set a -> Set a #

min :: Set a -> Set a -> Set a #

Hashable v => Hashable (Set v)

Since: hashable-1.3.4.0

Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Set v -> Int #

hash :: Set v -> Int #

Ord k => At (Set k) 
Instance details

Defined in Control.Lens.At

Methods

at :: Index (Set k) -> Lens' (Set k) (Maybe (IxValue (Set k))) #

Ord a => Contains (Set a) 
Instance details

Defined in Control.Lens.At

Methods

contains :: Index (Set a) -> Lens' (Set a) Bool #

Ord k => Ixed (Set k) 
Instance details

Defined in Control.Lens.At

Methods

ix :: Index (Set k) -> Traversal' (Set k) (IxValue (Set k)) #

Ord a => Wrapped (Set a) 
Instance details

Defined in Control.Lens.Wrapped

Associated Types

type Unwrapped (Set a) #

Methods

_Wrapped' :: Iso' (Set a) (Unwrapped (Set a)) #

(t ~ Set a', Ord a) => Rewrapped (Set a) t

Use _Wrapping fromList. unwrapping returns a sorted list.

Instance details

Defined in Control.Lens.Wrapped

type Item (Set a) 
Instance details

Defined in Data.Set.Internal

type Item (Set a) = a
type Index (Set a) 
Instance details

Defined in Control.Lens.At

type Index (Set a) = a
type IxValue (Set k) 
Instance details

Defined in Control.Lens.At

type IxValue (Set k) = ()
type Unwrapped (Set a) 
Instance details

Defined in Control.Lens.Wrapped

type Unwrapped (Set a) = [a]