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. Installing Yesod! (Gilberto Melfe)
2. Haskell code as DSL (Rosario Borda)
3. Re: Haskell code as DSL (Mateusz Kowalczyk)
4. Re: Installing Yesod! (Michael Snoyman)
5. Re: Capture the notion of invertible (Javran Cheng)
6. Re: Capture the notion of invertible (Brent Yorgey)
----------------------------------------------------------------------
Message: 1
Date: Thu, 20 Mar 2014 19:46:35 +0000
From: Gilberto Melfe <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Installing Yesod!
Message-ID:
<cah5k6k7p1ph+o5xur9o4-vfrunapygvp+cn5tyz3b80bi6v...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hello People!
I've been trying to get Yesod going!
Updated cabal (as instructed).
Installed the yesod-platform package.
Next step, would be to install the yesod-bin package (for the yesod
executable, server and stuff...)! But when I try:
./cabal install --dry-run yesod-bin
I get these messages:
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: yesod-bin-1.2.7.3 (user goal)
next goal: ghc (dependency of yesod-bin-1.2.7.3)
Dependency tree exhaustively searched.
I'm gonna get into trouble again, right?
Can anyone tell me what to do next?
Thank you very much!
Gilberto
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140320/ec80d939/attachment-0001.html>
------------------------------
Message: 2
Date: Thu, 20 Mar 2014 20:50:04 +0100
From: Rosario Borda <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Haskell code as DSL
Message-ID:
<cabq_edtr+y8_gsrcmrtx7g7u9zjia_uk4qkurtkgrfd69oc...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hello Haskellers,
what about insert haskell code as DSL in haskell program? as an example, in
ghci:
> eval [haskell| tail [0,1,2,3]|]
[1,2,3]
as intermediate step to get an interactive word-based italian translation
of haskell:
> eval [italian| coda [0,1,2,3]|]
[1,2,3]
I'm an italian primary school teacher and I would like to introduce
my schoolchildren to FP using haskell...
Thank you very much, see You son.
Rosario
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140320/f1bfcaae/attachment-0001.html>
------------------------------
Message: 3
Date: Thu, 20 Mar 2014 20:17:05 +0000
From: Mateusz Kowalczyk <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Haskell code as DSL
Message-ID: <[email protected]>
Content-Type: text/plain; charset=windows-1252
On 20/03/14 19:50, Rosario Borda wrote:
> Hello Haskellers,
> what about insert haskell code as DSL in haskell program? as an example, in
> ghci:
>
>> eval [haskell| tail [0,1,2,3]|]
> [1,2,3]
>
> as intermediate step to get an interactive word-based italian translation
> of haskell:
>
>> eval [italian| coda [0,1,2,3]|]
> [1,2,3]
>
> I'm an italian primary school teacher and I would like to introduce
> my schoolchildren to FP using haskell...
>
> Thank you very much, see You son.
> Rosario
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
What's wrong with making something like Prelude.Italian which re-exports
the common functions under their Italian equivalents?
It'd just contain things like
coda = tail
?
Isn't this much easier than messing with Template Haskell and
effectively achieving the same thing? Maybe there's something I'm
missing here.
--
Mateusz K.
------------------------------
Message: 4
Date: Thu, 20 Mar 2014 22:20:33 +0200
From: Michael Snoyman <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Installing Yesod!
Message-ID:
<CAKA2JgLzPpfCz_A2NBbnAx3Pymhkjvuk=kegpd4nqlrc-6y...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Are you using the Fedora system installation of GHC by any chance? If so,
the problem is that Fedora doesn't include GHC-as-a-library by default. See
[1] for more details and how to resolve it.
If you're *not* on Fedora, please provide more information on your OS and
how you install GHC/Haskell Platform.
[1] https://groups.google.com/d/msg/yesodweb/AM8VeHpu8IU/xtzjltFwcEgJ
On Thu, Mar 20, 2014 at 9:46 PM, Gilberto Melfe <[email protected]>wrote:
> Hello People!
>
> I've been trying to get Yesod going!
>
> Updated cabal (as instructed).
> Installed the yesod-platform package.
>
> Next step, would be to install the yesod-bin package (for the yesod
> executable, server and stuff...)! But when I try:
>
> ./cabal install --dry-run yesod-bin
>
> I get these messages:
>
> Resolving dependencies...
> cabal: Could not resolve dependencies:
> trying: yesod-bin-1.2.7.3 (user goal)
> next goal: ghc (dependency of yesod-bin-1.2.7.3)
> Dependency tree exhaustively searched.
>
> I'm gonna get into trouble again, right?
>
> Can anyone tell me what to do next?
>
> Thank you very much!
>
> Gilberto
>
> _______________________________________________
> 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/20140320/3b136eec/attachment-0001.html>
------------------------------
Message: 5
Date: Thu, 20 Mar 2014 16:25:07 -0400
From: Javran Cheng <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Capture the notion of invertible
Message-ID:
<ca+tfdnb52pmgqjjc+6-kz3sud4ryq1cr+kah0f4lw99grpc...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
I thought every Monad is a Category because I see
"instance Monad m => Category (Kleisli m)" in Control.Category,
So what are the other ways?
I tried to do the exercise:
import Prelude hiding ((.), id)
import Control.Category
import Control.Arrow
import Data.Monoid
newtype Endomorphism cat a = E { runE :: cat a a }
instance Category cat => Monoid (Endomorphism cat a) where
mempty = E id
(E g) `mappend` (E f) = E (g . f)
testMonoid :: [Endomorphism (Kleisli []) Int]
testMonoid = map (E . Kleisli)
[ \x -> [x, x+1]
, \x -> [x-1, x]
, \x -> [x+10]
]
main :: IO ()
main =
print $ runKleisli (runE (mconcat testMonoid)) 10
-- [10]
-- > [10,11]
-- > [9,10, 10,11]
-- > [19,20,20,21]
Is this what you meant?
Javran
> Date: Thu, 20 Mar 2014 09:47:30 -0400
> From: Brent Yorgey <[email protected]>
> To: [email protected]
> Subject: Re: [Haskell-beginners] Capture the notion of invertible
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=us-ascii
>
> On Thu, Mar 20, 2014 at 02:18:12AM -0400, Javran Cheng wrote:
>> Off topic:
>
> This is not off topic for the beginners list at all. =)
>
>> This comment makes perfect sense to me, because "monoid-like" reminds
>> me of Data.Monoid,
>> which does not totally capture what I know about monoid: monad is
>> "just a monoid in the category of endofunctors"
>
> The "monoid" being referred to here is a very generalized sense of the
> word, and is quite different from (though distantly related to)
> Haskell's Monoid type class.
>
>> but Monad is not in any sense fit into a Monoid.
>> Here I find that when I talk about "monoid-like", I actually refer to
>> Category,
>> and Monad is an instance of Category, which backs up my guess.
>
> "Monad is an instance of Category" --- this doesn't really make
> sense as stated. It's certainly not true that every instance of Monad
> is also an instance of Category; the kinds don't even match. It is
> true that you can build a Category out of a Monad, though there are
> actually several ways to do so. The most well-known in the Haskell
> world is Kleisli, but there are other ways.
>
>> In a word, can I say that when talking about reducing data (Sum,
>> Product, etc.), I'm referring to Monoid,
>> and when I talking about monoid-like composition, I'm referring to
>> Category?
>
> "monoid-like composition" can refer to Monoid too. The essential
> difference is *types*: in particular you can think of a Category as a
> "typed Monoid": with a Monoid, *any* two things can be composed. With
> a Category, you can only compose things whose types match. So
> conversely you can also think of a Monoid as a "Category with only one
> type". As an (easy) exercise:
>
> newtype Endomorphism cat a = E (cat a a)
>
> instance Category cat => Monoid (Endomorphism cat a) where
> ...
>
> -Brent
>
>>
>> Javran
>>
>> > Date: Tue, 18 Mar 2014 02:48:21 +0700
>> > From: Kim-Ee Yeoh <[email protected]>
>> > To: The Haskell-Beginners Mailing List - Discussion of primarily
>> > beginner-level topics related to Haskell <[email protected]>
>> > Subject: Re: [Haskell-beginners] Capture the notion of invertible
>> > functions
>> > Message-ID:
>> >
>> > <CAPY+ZdTyj81gcUaZJfHGeta8rbjxup8ReKHJ=iy7epzkkqp...@mail.gmail.com>
>> > Content-Type: text/plain; charset="iso-8859-1"
>> >
>> > > When you're talking about invertible functions, the idea you're probably
>> > reaching for is an isomorphism -- that is, we want the function to have
>> > certain nice properties on top of just being a map from a -> b with an
>> > inverse map from b -> a.
>> >
>> > The usual meaning of 'f is invertible' is that it is both left- and
>> > right-invertible, thus making it bijective: see first bullet in [1].
>> >
>> > Here you're alluding to f being merely left-invertible, something I don't
>> > see mentioned in OP.
>> >
>> > > You also want the function to be a bijection, which is captured in the
>> > notion of an isomorphism.
>> >
>> > I'm reminded of a reddit convo where the idea was tossed out that
>> > semigroups should always be promoted to monoids [2].
>> >
>> > I argued no. I also cited a case where a supposedly nicer monoid causes
>> > more problems for a ghc hacker than the true semigroup [3].
>> >
>> > Having structure is nice. And sometimes we just have to work with what's
>> > given to us.
>> >
>> > Category theory calls a /monomorphism/ something that's strictly weaker
>> > than left-invertible. An arrow that's (additionally) left-invertible
>> > corresponds to a /split mono/.
>> >
>> > Hence in order of _decreasing_ niceness: Iso, Split mono, Mono. As research
>> > uncovers more interesting phenomena, this sequence will continuing growing
>> > to the right.
>> >
>> > We can't always impose that niceness because that nukes whatever we're
>> > studying. So we gotta respect the situation. And given lemons, make
>> > lemonade.
>> >
>> >
>> > [1]
>> > http://en.wikipedia.org/wiki/Bijection,_injection_and_surjection#Bijection
>> >
>> > [2]
>> > http://www.reddit.com/r/haskell/comments/1ou06l/improving_applicative_donotation/ccvtqot?context=1
>> >
>> > [3]
>> > http://www.reddit.com/r/haskell/comments/1ou06l/improving_applicative_donotation/ccy4n2d
>>
>>
>>
>>
>>
>> --
>> Javran (Fang) Cheng
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>>
------------------------------
Message: 6
Date: Thu, 20 Mar 2014 17:04:43 -0400
From: Brent Yorgey <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Capture the notion of invertible
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
Hi Javran,
On Thu, Mar 20, 2014 at 04:25:07PM -0400, Javran Cheng wrote:
> I thought every Monad is a Category because I see
> "instance Monad m => Category (Kleisli m)" in Control.Category,
This does not say "every Monad is a Category". It says "Kleisli m is
a Category whenever m is a Monad". So you could say "every Monad
*gives rise to* (not *is*) a Category".
> So what are the other ways?
There is another construction called the Eilenberg-Moore category of a
monad. I have never seen anyone encode it in Haskell; it would
actually be difficult since the objects of the category would not be
Haskell types but monad algebras (though I'm sure it is possible).
The Category class can only encode categories whose objects are
Haskell types.
> I tried to do the exercise:
>
> newtype Endomorphism cat a = E { runE :: cat a a }
>
> instance Category cat => Monoid (Endomorphism cat a) where
> mempty = E id
> (E g) `mappend` (E f) = E (g . f)
>
> Is this what you meant?
Yes, exactly right.
-Brent
> > Date: Thu, 20 Mar 2014 09:47:30 -0400
> > From: Brent Yorgey <[email protected]>
> > To: [email protected]
> > Subject: Re: [Haskell-beginners] Capture the notion of invertible
> > Message-ID: <[email protected]>
> > Content-Type: text/plain; charset=us-ascii
> >
> > On Thu, Mar 20, 2014 at 02:18:12AM -0400, Javran Cheng wrote:
> >> Off topic:
> >
> > This is not off topic for the beginners list at all. =)
> >
> >> This comment makes perfect sense to me, because "monoid-like" reminds
> >> me of Data.Monoid,
> >> which does not totally capture what I know about monoid: monad is
> >> "just a monoid in the category of endofunctors"
> >
> > The "monoid" being referred to here is a very generalized sense of the
> > word, and is quite different from (though distantly related to)
> > Haskell's Monoid type class.
> >
> >> but Monad is not in any sense fit into a Monoid.
> >> Here I find that when I talk about "monoid-like", I actually refer to
> >> Category,
> >> and Monad is an instance of Category, which backs up my guess.
> >
> > "Monad is an instance of Category" --- this doesn't really make
> > sense as stated. It's certainly not true that every instance of Monad
> > is also an instance of Category; the kinds don't even match. It is
> > true that you can build a Category out of a Monad, though there are
> > actually several ways to do so. The most well-known in the Haskell
> > world is Kleisli, but there are other ways.
> >
> >> In a word, can I say that when talking about reducing data (Sum,
> >> Product, etc.), I'm referring to Monoid,
> >> and when I talking about monoid-like composition, I'm referring to
> >> Category?
> >
> > "monoid-like composition" can refer to Monoid too. The essential
> > difference is *types*: in particular you can think of a Category as a
> > "typed Monoid": with a Monoid, *any* two things can be composed. With
> > a Category, you can only compose things whose types match. So
> > conversely you can also think of a Monoid as a "Category with only one
> > type". As an (easy) exercise:
> >
> > newtype Endomorphism cat a = E (cat a a)
> >
> > instance Category cat => Monoid (Endomorphism cat a) where
> > ...
> >
> > -Brent
> >
> >>
> >> Javran
> >>
> >> > Date: Tue, 18 Mar 2014 02:48:21 +0700
> >> > From: Kim-Ee Yeoh <[email protected]>
> >> > To: The Haskell-Beginners Mailing List - Discussion of primarily
> >> > beginner-level topics related to Haskell <[email protected]>
> >> > Subject: Re: [Haskell-beginners] Capture the notion of invertible
> >> > functions
> >> > Message-ID:
> >> >
> >> > <CAPY+ZdTyj81gcUaZJfHGeta8rbjxup8ReKHJ=iy7epzkkqp...@mail.gmail.com>
> >> > Content-Type: text/plain; charset="iso-8859-1"
> >> >
> >> > > When you're talking about invertible functions, the idea you're
> >> > > probably
> >> > reaching for is an isomorphism -- that is, we want the function to have
> >> > certain nice properties on top of just being a map from a -> b with an
> >> > inverse map from b -> a.
> >> >
> >> > The usual meaning of 'f is invertible' is that it is both left- and
> >> > right-invertible, thus making it bijective: see first bullet in [1].
> >> >
> >> > Here you're alluding to f being merely left-invertible, something I don't
> >> > see mentioned in OP.
> >> >
> >> > > You also want the function to be a bijection, which is captured in the
> >> > notion of an isomorphism.
> >> >
> >> > I'm reminded of a reddit convo where the idea was tossed out that
> >> > semigroups should always be promoted to monoids [2].
> >> >
> >> > I argued no. I also cited a case where a supposedly nicer monoid causes
> >> > more problems for a ghc hacker than the true semigroup [3].
> >> >
> >> > Having structure is nice. And sometimes we just have to work with what's
> >> > given to us.
> >> >
> >> > Category theory calls a /monomorphism/ something that's strictly weaker
> >> > than left-invertible. An arrow that's (additionally) left-invertible
> >> > corresponds to a /split mono/.
> >> >
> >> > Hence in order of _decreasing_ niceness: Iso, Split mono, Mono. As
> >> > research
> >> > uncovers more interesting phenomena, this sequence will continuing
> >> > growing
> >> > to the right.
> >> >
> >> > We can't always impose that niceness because that nukes whatever we're
> >> > studying. So we gotta respect the situation. And given lemons, make
> >> > lemonade.
> >> >
> >> >
> >> > [1]
> >> > http://en.wikipedia.org/wiki/Bijection,_injection_and_surjection#Bijection
> >> >
> >> > [2]
> >> > http://www.reddit.com/r/haskell/comments/1ou06l/improving_applicative_donotation/ccvtqot?context=1
> >> >
> >> > [3]
> >> > http://www.reddit.com/r/haskell/comments/1ou06l/improving_applicative_donotation/ccy4n2d
> >>
> >>
> >>
> >>
> >>
> >> --
> >> Javran (Fang) Cheng
> >> _______________________________________________
> >> Beginners mailing list
> >> [email protected]
> >> http://www.haskell.org/mailman/listinfo/beginners
> >>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 69, Issue 30
*****************************************