atzeus/type-aligned — pull request #2 by michaelt (2014-12-26 14:41:04+00:00)
Title: functorish class

I'm not sure what this Functor-like class should be called,

class Maps phi where -- laws like Functor
maps :: (forall x y . p x y -> q x y) -> phi p a b -> phi q a b

but it needs to be threaded through starting with

instance Maps Cons where
maps phi Nil = Nil
maps phi (Cons a bs) = Cons (phi a) (maps phi bs)
{-# INLINABLE maps #-}

if we are to be able to use it with `type FastTCQueue = ToCatQueue FastQueue`

I was trying to write a `FreeT` module, or possibly a more specialized one https://github.com/michaelt/remorse/blob/master/Remorse/Free.hs . (My ultimate purpose might be visible here https://github.com/michaelt/series). I hadn't realized `type-aligned` was on hackage, so I made a little replica of some of it .

But I was immediately needing something like `maps` to write several fundamenta functions, e.g. `hoistFreeT`, `transFreeT` (to use the hideous names from the `free` package), and to write the MFunctor and MMonad instances. The same problem arose in the little prelude I started to write https://github.com/michaelt/remorse/blob/master/Remorse/Prelude.hs#L240 which a little closer to my purpose. I might be able to get around some of these, but since the constructors for `ToCatQueue` and `FastQueue` aren't exposed, the most natural approaches were blocked -- to defined things directly, or with my own `Maps` class.