I think it's more realistic to use lens style Setters where possible. Essentially: type Setter s t a b = (a -> b) -> s -> t type Setter' s a = Setter s s a a bytes :: Setter ByteString Word8 bytes = BS.map fmapped :: Functor f => Setter (f a) (f b) a b fmapped = fmap In this framework, you could write a function that can abstract over any setter, eg. changeSomething :: Setter s t Foo Bar -> s -> t changeSomething s = s fooBar where fooBar :: Foo -> Bar It's not quite the same thing as making ByteString or Text an instance of Functor, but for some tasks, it can be a good replacement. On Sun, 01 Mar 2015 02:08:40 +0100, silvio <silvio.frischi@gmail.com> wrote:
Wow ConstraintKinds. There's always a new extension to be learned :) Anyway, if changing the Functor declaration were allowed, it would probably make more sense to use something like MonoFunctor. Unfortunately, MPTC or type family stuff is never going to make it into Prelude.
Silvio _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe