[Haskell-cafe] is it possible to implement Functor for ByteString and Text

Ben Franksen ben.franksen at online.de
Fri Mar 6 04:47:09 UTC 2015


silvio wrote:
> cool trick. This is by far the best solution yet. Of course it's a bit
> deceptive in what you are working with. E.g.
> 
> bs1 <- pack [1..10]
> print bs1
> let bs2 = map (+1) bs1
> print bs2
> let bs3 = map (+1) bs2
> print bs3
> ...
> let bsn = map (+1) bsn_1
> print bsn
> 
> will have quadratic complexity.

One could perhaps replace id with unsafeCoerce in wrap?

Cheers
Ben



More information about the Haskell-Cafe mailing list