simple-expr-0.2.0.0: Minimalistic toolkit for simple mathematical expression.
Copyright(C) 2025 Alexey Tochin
LicenseBSD3 (see the file LICENSE)
MaintainerAlexey Tochin <Alexey.Tochin@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Control.ExtendableMap

Description

ExtandableMap class and its instances.

Synopsis

Documentation

class ExtandableMap a b c d where Source #

Type is similar to fmap, but it can extend the function application. It can apply a function to each element and subelements of a tuple, list, sized vector, stream, etc.

Examples

Expand
>>> import GHC.Base (Bool(True, False), Int)
>>> import GHC.Show (show)
>>> import GHC.Num ((*))
>>> import Data.String (String)
>>> extendMap (show :: Int -> String) (42 :: Int) :: String
"42"
>>> extendMap (show :: Bool -> String) (True, False) :: (String, String)
("True","False")
>>> extendMap ((*2) :: Int -> Int) (1 :: Int, (2 :: Int, 3 :: Int)) :: (Int, (Int, Int))
(2,(4,6))
>>> extendMap ((*2) :: Int -> Int) ([1, 2, 3] :: [Int], (4 :: Int, 5 :: Int)) :: ([Int], (Int, Int))
([2,4,6],(8,10))

Methods

extendMap :: (a -> b) -> c -> d Source #

Instances

Instances details
ExtandableMap a b a b Source #

Trivial instance of ExtandableMap.

Instance details

Defined in Control.ExtendableMap

Methods

extendMap :: (a -> b) -> a -> b Source #

ExtandableMap a b c d => ExtandableMap a b (Stream c) (Stream d) Source #

Stream instance of ExtandableMap.

Instance details

Defined in Control.ExtendableMap

Methods

extendMap :: (a -> b) -> Stream c -> Stream d Source #

ExtandableMap a b c d => ExtandableMap a b (Traced c) (Traced d) Source #

Traced instance fo ExtandableMaptypecalss.

Instance details

Defined in Debug.SimpleExpr.Utils.Traced

Methods

extendMap :: (a -> b) -> Traced c -> Traced d Source #

ExtandableMap a b c d => ExtandableMap a b [c] [d] Source #

List `[]` instance of ExtandableMap.

Instance details

Defined in Control.ExtendableMap

Methods

extendMap :: (a -> b) -> [c] -> [d] Source #

(ExtandableMap a b c0 d0, ExtandableMap a b c1 d1) => ExtandableMap a b (c0, c1) (d0, d1) Source #

Tuple instance of ExtandableMap.

Instance details

Defined in Control.ExtendableMap

Methods

extendMap :: (a -> b) -> (c0, c1) -> (d0, d1) Source #

ExtandableMap a b c d => ExtandableMap a b (r -> c) (r -> d) Source #

Function `(->) r` instance of ExtandableMap.

Instance details

Defined in Control.ExtendableMap

Methods

extendMap :: (a -> b) -> (r -> c) -> r -> d Source #

ExtandableMap a b c d => ExtandableMap a b (Vector Vector n c) (Vector Vector n d) Source #

Sized vector instance of ExtandableMap.

Instance details

Defined in Control.ExtendableMap

Methods

extendMap :: (a -> b) -> Vector Vector n c -> Vector Vector n d Source #

(ExtandableMap a b c0 d0, ExtandableMap a b c1 d1, ExtandableMap a b c2 d2) => ExtandableMap a b (c0, c1, c2) (d0, d1, d2) Source #

Triple instance of ExtandableMap.

Instance details

Defined in Control.ExtendableMap

Methods

extendMap :: (a -> b) -> (c0, c1, c2) -> (d0, d1, d2) Source #