[Haskell-cafe] Higher order functor package?

Clinton Mead clintonmead at gmail.com
Tue Jul 11 07:13:09 UTC 2017


I don't think this is quite the same.

`compdata` seems to define:

(f :->
<http://hackage.haskell.org/package/compdata-0.11/docs/Data-Comp-Multi-HFunctor.html#t::-45--62->
g)
-> h f :->
<http://hackage.haskell.org/package/compdata-0.11/docs/Data-Comp-Multi-HFunctor.html#t::-45--62->
h
g

But I want:

(f :->
<http://hackage.haskell.org/package/compdata-0.11/docs/Data-Comp-Multi-HFunctor.html#t::-45--62->
g)
-> h f ->
<http://hackage.haskell.org/package/compdata-0.11/docs/Data-Comp-Multi-HFunctor.html#t::-45--62->
h
g

Notice the lack of colon between the last two arguments. It's ordinary
function application there.

On Tue, Jul 11, 2017 at 5:02 PM, Sergey Vinokurov <serg.foo at gmail.com>
wrote:

> Hi Clinton,
>
> Sorry for late reply, but just for the sake of completeness the
> compdata package defines just the functor you mentioned
> http://hackage.haskell.org/package/compdata-0.11/docs/
> Data-Comp-Multi-HFunctor.html#t:HFunctor.
>
> Regards,
> Sergey
>
> On Tue, Jul 11, 2017 at 9:18 AM, Clinton Mead <clintonmead at gmail.com>
> wrote:
> > Hi All
> >
> > Thanks for all your help.
> >
> > I've actually picked up Mario's rank2classes package as it seems like I
> need
> > a little but more power than Functors, as I want things like `liftA2` for
> > example.
> >
> > I've pushed across a very simple pull request to you Mario that simply
> adds
> > "PolyKinds" to your list of language extensions. This automatically this
> > generalises the kinds your Functor and Apply accept (and perhaps others)
> as
> > I'm quantifying not over * but over a data kind type. No other changes
> are
> > needed.
> >
> > Clinton
> >
> > On Sat, Jul 8, 2017 at 5:57 AM, Mario Blažević <mblazevic at stilo.com>
> wrote:
> >>
> >> On 2017-07-07 12:48 AM, Clinton Mead wrote:
> >>>
> >>> Consider the illustrative code below:
> >>> ...
> >>>     class MyFunctor f where
> >>>        myFmap :: (forall a. t a -> u a) -> f t -> f u
> >>> ...
> >>>
> >>>
> >>> Basically this is a sort of "higher order" functor, but I can't seem to
> >>> fit it into an ordinary functor.
> >>>
> >>> But it seems like I'm reinventing the wheel, as my code is suspiciously
> >>> like `Functor` but only slightly different.
> >>>
> >>> Has this sort of class already been created and if so what package is
> it
> >>> in?
> >>
> >>
> >> Yes, I have recently created rank2classes package:
> >>
> >>    http://hackage.haskell.org/package/rank2classes
> >>
> >>         Apart from the mirror-universe Functor class, the package
> exports
> >> the Applicative, Foldable, Traversable, Applicative, and Distributive
> >> classes, as well as some Template Hashell to derive some of their
> instances
> >> automatically.
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> Haskell-Cafe mailing list
> >> To (un)subscribe, modify options or view archives go to:
> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> >> Only members subscribed via the mailman list are allowed to post.
> >
> >
> >
> > _______________________________________________
> > Haskell-Cafe mailing list
> > To (un)subscribe, modify options or view archives go to:
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> > Only members subscribed via the mailman list are allowed to post.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170711/ad50cc99/attachment.html>


More information about the Haskell-Cafe mailing list