Add FMap to avoid clash with containers

This commit is contained in:
Lysxia 2020-03-08 11:00:38 -04:00
parent 24c14a0b17
commit fc18ad42df

View File

@ -8,12 +8,16 @@
module Fcf.Class.Functor
( Map
, FMap
) where
import Fcf.Core (Exp, Eval)
-- | Type-level 'fmap' for type-level functors.
--
-- Note: this name clashes with 'Data.Map.Lazy.Map' from /containers/.
-- 'FMap' is provided as a synonym to avoid this.
--
-- === __Example__
--
-- >>> import Fcf.Data.Nat
@ -25,6 +29,9 @@ import Fcf.Core (Exp, Eval)
-- = '[4, 9, 16, 25, 36]
data Map :: (a -> Exp b) -> f a -> Exp (f b)
-- | Synonym of 'Map' to avoid name clashes.
type FMap = Map
-- []
type instance Eval (Map f '[]) = '[]
type instance Eval (Map f (a ': as)) = Eval (f a) ': Eval (Map f as)