
Thanks guys to try to enlighten me. However, nothing contradicts the view of (a,a) as a container of two elements except for your very specific interpretation of "container" in terms of unary type transformers, type classes, and what not. Some delusions have very sophisticated explanations. On 18.02.2016 15:37, Marcin Mrotek wrote:
I also do not see why (a,a) could not be a container of exactly two elements, as opposed to current GHC which insists it is a container of exactly one element. (Case for the mental institution, I'd say.)
Because this isn't how types in Haskell works. `Foo a a` always parsed to `(Foo a) a` and no instance of any class can implement it differently than `(Foo b) a`, unless you want to throw parametricity out of the window. This has been long before `Foldable`.
Best regards, Marcin Mrotek
On 18.02.2016 15:37, Manuel Gómez wrote: On Thu, Feb 18, 2016 at 9:58 AM, Andreas Abel
wrote: I also do not see why (a,a) could not be a container of exactly two elements, as opposed to current GHC which insists it is a container of exactly one element. (Case for the mental institution, I'd say.)
Because, given
data T a = T a a data T' a b = T a b
these two types have essential structural differences at the type level, despite being isomorphic:
forall a. T a forall a. T' a a
Type classes exist at the type level. These things are decidedly different at the type level. It’s to be expected that their behavior under Functor differs.
-- Andreas Abel <>< Du bist der geliebte Mensch. Department of Computer Science and Engineering Chalmers and Gothenburg University, Sweden andreas.abel@gu.se http://www2.tcs.ifi.lmu.de/~abel/