The name of the product is `Const` and the functor?

Is SF already defined anywhere or at least has a name?

 data SF afx = SF a (fx) instance Functor f => Functor (SF af) where fmap g (SF a fx) = SF a (fmap g fx) 
+5
source share
2 answers

Your functor looks like

 type SF af = (,) a :. f 

using functor-combo .

(I somehow prefer to look at it using composition rather than using the product and Const .)

+4
source

You can simply define functor products

 data (f :* g) a = P (fa) (ga) deriving Functor 

and then write it directly

 type SF af = Const a :* f 
+1
source

Source: https://habr.com/ru/post/1203890/


All Articles