packages feed

FiniteCategories-0.1.0.0: src/Utils/EnumerateMaps.hs

{-| Module  : FiniteCategories
Description : Enumerate all maps between two lists.
Copyright   : Guillaume Sabbagh 2021
License     : GPL-3
Maintainer  : guillaumesabbagh@protonmail.com
Stability   : experimental
Portability : portable

Enumerate all maps between two lists.
-}
module Utils.EnumerateMaps
(
    enumMaps
)
where
    import Utils.CartesianProduct
    import Utils.AssociationList
    
    -- | Returns all association lists from a domain to a codomain.
    enumMaps :: [a] -- ^ Domain.
             -> [b] -- ^ Codomain.
             -> [AssociationList a b] -- ^ All association lists from domain to codomain.
    enumMaps dom codom = zip dom <$> codom |^| (length dom)