Is SF
already defined anywhere, or does it at least have a name?
data SF a f x = SF a (f x)
instance Functor f => Functor (SF a f) where
fmap g (SF a fx) = SF a (fmap g fx)
Your functor looks like
type SF a f = (,) a :. f
using functor-combo notation.
(I somehow prefer to look at it using composition, rather than using product and Const
.)
You could just define functor products
data (f :* g) a = P (f a) (g a) deriving Functor
and then write it directly
type SF a f = Const a :* f
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With