Hoogle Search
Within LTS Haskell 24.28 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
mapReader :: (a -> b) -> Reader r a -> Reader r bcan-i-haz Control.Monad.Reader.Has Transform the value returned by a Reader.
mapReaderT :: (m a -> n b) -> ReaderT r m a -> ReaderT r n bcan-i-haz Control.Monad.Reader.Has Transform the computation inside a ReaderT.
runReaderT (mapReaderT f m) = f . runReaderT m
mapMaybeVarEnv :: (a -> Maybe b) -> VarEnv a -> VarEnv bclash-lib Clash.Core.VarEnv Apply a function to every element in the environment; values for which the function returns Nothing are removed from the environment
mapVarEnv :: (a -> b) -> VarEnv a -> VarEnv bclash-lib Clash.Core.VarEnv Apply a function to every element in the environment
mapMaybe :: (a -> Maybe b) -> UniqMap a -> UniqMap bclash-lib Clash.Data.UniqMap Apply a function to all elements in the map, keeping those where the result is not Nothing.
-
code-conjure Conjure.Engine > map' absE (unit one) map abs [1] :: [Int]
mapConsts :: (Expr -> Expr) -> Expr -> Exprcode-conjure Conjure.Engine O(n*m). Applies a function to all terminal constants in an expression. Given that:
> let one = val (1 :: Int) > let two = val (2 :: Int) > let xx -+- yy = value "+" ((+) :: Int->Int->Int) :$ xx :$ yy > let intToZero e = if typ e == typ zero then zero else e
Then:> one -+- (two -+- xx) 1 + (2 + x) :: Int
> mapConsts intToZero (one -+- (two -+- xx)) 0 + (0 + x) :: Integer
Given that the argument function is O(m), this function is O(n*m).-
code-conjure Conjure.Engine map over the Int element type encoded as an Expr
> mapE map :: (Int -> Int) -> [Int] -> [Int]
mapSubexprs :: (Expr -> Maybe Expr) -> Expr -> Exprcode-conjure Conjure.Engine O(n*m). Substitute subexpressions of an expression using the given function. Outer expressions have more precedence than inner expressions. (cf. //) With:
> let xx = var "x" (undefined :: Int) > let yy = var "y" (undefined :: Int) > let zz = var "z" (undefined :: Int) > let plus = value "+" ((+) :: Int->Int->Int) > let times = value "*" ((*) :: Int->Int->Int) > let xx -+- yy = plus :$ xx :$ yy > let xx -*- yy = times :$ xx :$ yy
> let pluswap (o :$ xx :$ yy) | o == plus = Just $ o :$ yy :$ xx | pluswap _ = Nothing
Then:> mapSubexprs pluswap $ (xx -*- yy) -+- (yy -*- zz) y * z + x * y :: Int
> mapSubexprs pluswap $ (xx -+- yy) -*- (yy -+- zz) (y + x) * (z + y) :: Int
Substitutions do not stack, in other words a replaced expression or its subexpressions are not further replaced:> mapSubexprs pluswap $ (xx -+- yy) -+- (yy -+- zz) (y + z) + (x + y) :: Int
Given that the argument function is O(m), this function is O(n*m).mapValues :: (Expr -> Expr) -> Expr -> Exprcode-conjure Conjure.Engine O(n*m). Applies a function to all terminal values in an expression. (cf. //-) Given that:
> let zero = val (0 :: Int) > let one = val (1 :: Int) > let two = val (2 :: Int) > let three = val (3 :: Int) > let xx -+- yy = value "+" ((+) :: Int->Int->Int) :$ xx :$ yy > let intToZero e = if typ e == typ zero then zero else e
Then:> one -+- (two -+- three) 1 + (2 + 3) :: Int
> mapValues intToZero $ one -+- (two -+- three) 0 + (0 + 0) :: Integer
Given that the argument function is O(m), this function is O(n*m).