13 lines
393 B
Haskell
13 lines
393 B
Haskell
{-# LANGUAGE UndecidableInstances #-}
|
|
module Functor.Compose where
|
|
|
|
import Functor.Base
|
|
import Relation
|
|
|
|
data Compose g f x = (Functor g, Functor f, Cod g ~ (->), Dom g ~ Cod f) => Compose { getCompose :: !(g (f x)) }
|
|
|
|
instance Category (Dom f) => Functor (Compose g f) where
|
|
type Cod (Compose g f) = (->)
|
|
type Dom (Compose g f) = Dom f
|
|
map f (Compose x) = Compose (map (map f) x)
|