21 lines
431 B
Haskell
21 lines
431 B
Haskell
|
{-|
|
||
|
Module : Kino.Misc
|
||
|
Description : Contains miscellaneous helper functions which do not fit elsewhere
|
||
|
|
||
|
Contains miscellaneous helper functions which do not fit elsewhere
|
||
|
-}
|
||
|
|
||
|
module Kino.Misc where
|
||
|
|
||
|
infixl 3 !?
|
||
|
-- | Safe version of (!!)
|
||
|
(!?) :: [a] -> Int -> Maybe a
|
||
|
[] !? _ = Nothing
|
||
|
(x:_) !? 0 = Just x
|
||
|
(_:xs) !? n = xs !? (n-1)
|
||
|
|
||
|
infixl 0 $>
|
||
|
-- | Backwards function application
|
||
|
($>) :: a -> (a -> b) -> b
|
||
|
x $> f = f x
|