Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
- Data.Function variants
- Data.List variants
- Data.Maybe variants
- Data.Monoid variants
Core (shared) functions.
- (.:) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
- (.::) :: (Functor f, Functor g, Functor h) => (a -> b) -> f (g (h a)) -> f (g (h b))
- (.:::) :: (Functor f, Functor g, Functor h, Functor i) => (a -> b) -> f (g (h (i a))) -> f (g (h (i b)))
- (.::::) :: (Functor f, Functor g, Functor h, Functor i, Functor j) => (a -> b) -> f (g (h (i (j a)))) -> f (g (h (i (j b))))
- (.:::::) :: (Functor f, Functor g, Functor h, Functor i, Functor j, Functor k) => (a -> b) -> f (g (h (i (j (k a))))) -> f (g (h (i (j (k b)))))
- genericTakeMaybe :: Integral i => i -> [a] -> Maybe [a]
- uncons :: [a] -> (Maybe a, [a])
- lindex :: [a] -> Int -> Maybe a
- take_inf :: Int -> [a] -> [a]
- transpose_fw :: Int -> [[a]] -> [[Maybe a]]
- transpose_fw_def :: a -> Int -> [[a]] -> [[a]]
- transpose_fw_def' :: a -> [[a]] -> [[a]]
- transpose_st :: [[a]] -> [[a]]
- all_just :: [Maybe a] -> Maybe [a]
- mcycle :: Monoid a => a -> a
Data.Function variants
(.:::) :: (Functor f, Functor g, Functor h, Functor i) => (a -> b) -> f (g (h (i a))) -> f (g (h (i b))) Source
(.::::) :: (Functor f, Functor g, Functor h, Functor i, Functor j) => (a -> b) -> f (g (h (i (j a)))) -> f (g (h (i (j b)))) Source
(.:::::) :: (Functor f, Functor g, Functor h, Functor i, Functor j, Functor k) => (a -> b) -> f (g (h (i (j (k a))))) -> f (g (h (i (j (k b))))) Source
Data.List variants
genericTakeMaybe :: Integral i => i -> [a] -> Maybe [a] Source
Variant that either takes precisely n elements or Nothing
.
map (genericTake 3) (inits "abc") == inits "abc" Data.Maybe.mapMaybe (genericTakeMaybe 3) (inits "abc") == ["abc"]
uncons :: [a] -> (Maybe a, [a]) Source
Inverse of :
.
map uncons [[],1:[]] == [(Nothing,[]),(Just 1,[])]
transpose_fw :: Int -> [[a]] -> [[Maybe a]] Source
Variant of transpose
for fixed width interior lists. Holes
are represented by Nothing
.
transpose_fw undefined [] == []
transpose [[1,3],[2,4]] == [[1,2],[3,4]] transpose_fw 2 [[1,3],[2,4]] == [[Just 1,Just 2],[Just 3,Just 4]]
transpose [[1,5],[2],[3,7]] == [[1,2,3],[5,7]]
transpose_fw 2 [[1,4],[2],[3,6]] == [[Just 1,Just 2,Just 3] ,[Just 4,Nothing,Just 6]]
This function is more productive than transpose
for the case of
an infinite list of finite lists.
map head (transpose_fw 4 (repeat [1..4])) == map Just [1,2,3,4] map head (transpose (repeat [1..4])) == _|_
transpose_fw_def :: a -> Int -> [[a]] -> [[a]] Source
Variant of transpose_fw
with default value for holes.
transpose_fw_def' :: a -> [[a]] -> [[a]] Source
Variant of transpose_fw_def
deriving width from first element.
transpose_st :: [[a]] -> [[a]] Source
A transpose
variant, halting when first hole appears.
transpose_st [[1,2,3],[4,5,6],[7,8]] == [[1,4,7],[2,5,8]]