Created
October 2, 2015 11:44
-
-
Save razielgn/edc2e9e50280057079ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newtype ListLayer a = ListLayer [a] | |
class Layerable a where | |
something :: a -> a | |
instance Layerable (ListLayer a) where | |
something = id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is the relevant part.
And here’s is the error:
Things to be noted:
Layerable
. As we said, we can simply use a list ofa
.initialL
(for lists) maps over (a composition of)f
, so it’s not really it returns a list ofLTree b
. So the problem is how to enforce the equivalence between theLayer a
and[a]
, which in the end is the same question on the ML, but without the type class nonsense.Layerable
(yes, the name sucks) so my guess is that I cannot use some kind ofnewtype
because I can only have one constructor, AFAIK.Maybe the best course of action would be declare
Layer
a functor and usefmap
and be done with that?