"Lifted" First Class Families

There are many binary infix operators in first-class-families like ++ that are hard to use since they expect evaluated types, but most of the time the types will be wrapped in Exp. Are there “lifted” versions of these operators that can use types wrapped in Exp? If not, why?

Also, is first-class-families something that should still be used?

2 Likes

Are you looking for Pure, maybe?

data Pure :: a -> Exp a 

https://hackage.haskell.org/package/first-class-families-0.8.1.0/docs/Fcf.html#t:Pure

You might want to know about phadej’s defun library, which achieves defunctionalization with a slightly different design. Neither is more expressive than the other, as far as I understand.

1 Like

Pure1 (++) LiftM2 (++) does accomplish create the right type but it is no longer an infix operator.

Actually, I think I probably should have said LiftM2 (++). But that cannot be used as an infix operator (without a further binding, say type (.++) = LiftM2 (++)).

1 Like

Should type operators have the same infix* as there value operator counterparts?

I ask because some in the package have infix defined while others do not.

Who knows? That sounds like a reasonable policy, but it’s up to each package’s author, I suppose.

1 Like