Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Are functors in Haskell always injective? (Dimitri DeFigueiredo)
2. Re: Are functors in Haskell always injective?
(Dimitri DeFigueiredo)
3. Re: Are functors in Haskell always injective? (Julian Birch)
----------------------------------------------------------------------
Message: 1
Date: Sat, 05 Jul 2014 02:42:56 -0300
From: Dimitri DeFigueiredo <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] Are functors in Haskell always injective?
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi All,
My understanding is that a functor in Haskell is made of two "maps".
One that maps objects to objects that in Hask means types into types
(i.e. a type constructor)
And one that maps arrows into arrows, i.e. fmap.
My understanding is that a functor F in category theory is required to
preserve the domain and codomain of arrows, but it doesn't have to be
injective. In other words, two objects X and Y of category C (i.e. two
types in Hask) can be mapped into the same object Z (same type) in
category Z. As long as the "homomorphism" law holds:
F(f:X->Y) = F(f):F(X)->F(Y)
However, I don't think there is any way this mapping of types cannot be
injective in Haskell. It seems that a type constructor, when called with
two distinct type will always yield another two *distinct* types. (E.g.
Int and Fload yield Maybe Int and Maybe) So, it seems that Functors in
Haskell are actually more restrictive than functors can be in general.
Is this observation correct or did I misunderstand something?
Thanks!
Dimitri
------------------------------
Message: 2
Date: Sat, 05 Jul 2014 02:51:07 -0300
From: Dimitri DeFigueiredo <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Are functors in Haskell always
injective?
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
Oops! Sorry for the typos! Fixing that below.
Hi All,
My understanding is that a functor in Haskell is made of two "maps".
One that maps objects to objects that in Hask means types into types
(i.e. a type constructor)
And one that maps arrows into arrows, i.e. fmap.
My understanding is that a functor F in category theory is required to
preserve the domain and codomain of arrows, but it doesn't have to be
injective. In other words, two objects X and Y of category C (i.e. two
types in Hask) can be mapped into the same object Z (same type) in
category D. As long as the "homomorphism" law holds:
F(f:X->Y) = F(f):F(X)->F(Y)
However, I don't think there is any way this mapping of types cannot be
injective in Haskell. It seems that a type constructor, when called with
two distinct type will always yield another two *distinct* types. (E.g.
Int and Double yield Maybe Int and Maybe Double) So, it seems that
Functors in Haskell are actually more restrictive than functors can be
in general. Is this observation correct or did I misunderstand something?
Thanks!
Dimitri
Em 05/07/14 02:42, Dimitri DeFigueiredo escreveu:
> Hi All,
>
> My understanding is that a functor in Haskell is made of two "maps".
> One that maps objects to objects that in Hask means types into types
> (i.e. a type constructor)
> And one that maps arrows into arrows, i.e. fmap.
>
> My understanding is that a functor F in category theory is required to
> preserve the domain and codomain of arrows, but it doesn't have to be
> injective. In other words, two objects X and Y of category C (i.e. two
> types in Hask) can be mapped into the same object Z (same type) in
> category Z. As long as the "homomorphism" law holds:
>
> F(f:X->Y) = F(f):F(X)->F(Y)
>
> However, I don't think there is any way this mapping of types cannot
> be injective in Haskell. It seems that a type constructor, when called
> with two distinct type will always yield another two *distinct* types.
> (E.g. Int and Fload yield Maybe Int and Maybe) So, it seems that
> Functors in Haskell are actually more restrictive than functors can be
> in general. Is this observation correct or did I misunderstand something?
>
>
> Thanks!
>
>
> Dimitri
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140705/b46e1846/attachment-0001.html>
------------------------------
Message: 3
Date: Sat, 5 Jul 2014 11:51:10 +0100
From: Julian Birch <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Are functors in Haskell always
injective?
Message-ID:
<CAB0TuzCC5s89pSPH=O9p+xSqF_ObmLPUGfcomZSOd=7scay...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
(Another beginner here)
That's my understanding too. Functors in Haskell have to operate on the
whole of Hask, which isn't true of functors in general. Equally, they have
to map to a subset of Haskell (although that mapping could be isomorphic to
Hask e.g. Identity Functor). It's the first restriction that's the most
problematic, since it prevents set from being a Functor. This is fixable (
http://okmij.org/ftp/Haskell/RestrictedMonad.lhs) but not part of "standard
Haskell". The second restriction basically just means you've got to do
some book-keeping to get back to the original type.
Julian
On 5 July 2014 06:51, Dimitri DeFigueiredo <[email protected]> wrote:
> Oops! Sorry for the typos! Fixing that below.
>
>
> Hi All,
>
> My understanding is that a functor in Haskell is made of two "maps".
> One that maps objects to objects that in Hask means types into types (i.e.
> a type constructor)
> And one that maps arrows into arrows, i.e. fmap.
>
> My understanding is that a functor F in category theory is required to
> preserve the domain and codomain of arrows, but it doesn't have to be
> injective. In other words, two objects X and Y of category C (i.e. two
> types in Hask) can be mapped into the same object Z (same type) in category
> D. As long as the "homomorphism" law holds:
>
> F(f:X->Y) = F(f):F(X)->F(Y)
>
> However, I don't think there is any way this mapping of types cannot be
> injective in Haskell. It seems that a type constructor, when called with
> two distinct type will always yield another two **distinct** types. (E.g.
> Int and Double yield Maybe Int and Maybe Double) So, it seems that Functors
> in Haskell are actually more restrictive than functors can be in general.
> Is this observation correct or did I misunderstand something?
>
>
> Thanks!
>
>
> Dimitri
>
> Em 05/07/14 02:42, Dimitri DeFigueiredo escreveu:
>
> Hi All,
>
> My understanding is that a functor in Haskell is made of two "maps".
> One that maps objects to objects that in Hask means types into types (i.e.
> a type constructor)
> And one that maps arrows into arrows, i.e. fmap.
>
> My understanding is that a functor F in category theory is required to
> preserve the domain and codomain of arrows, but it doesn't have to be
> injective. In other words, two objects X and Y of category C (i.e. two
> types in Hask) can be mapped into the same object Z (same type) in category
> Z. As long as the "homomorphism" law holds:
>
> F(f:X->Y) = F(f):F(X)->F(Y)
>
> However, I don't think there is any way this mapping of types cannot be
> injective in Haskell. It seems that a type constructor, when called with
> two distinct type will always yield another two *distinct* types. (E.g. Int
> and Fload yield Maybe Int and Maybe) So, it seems that Functors in Haskell
> are actually more restrictive than functors can be in general. Is this
> observation correct or did I misunderstand something?
>
>
> Thanks!
>
>
> Dimitri
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140705/d720c5c4/attachment-0001.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 73, Issue 3
****************************************