Send Beginners mailing list submissions to beginners@haskell.org 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 beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Re: Problems installing plugins? (Patrick LeBoutillier) 2. Re: Monads (Patrick Lynch) 3. Re: Understanding the type signature of flip$id (Jeff Lasslett) ---------------------------------------------------------------------- Message: 1 Date: Wed, 2 Mar 2011 13:44:59 -0500 From: Patrick LeBoutillier <patrick.leboutill...@gmail.com> Subject: Re: [Haskell-beginners] Problems installing plugins? To: beginners <beginners@haskell.org> Message-ID: <AANLkTikXDLkCAegAj6DZE9CpLoSE=1bqhjxypxh9h...@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Got it. In Fedora 14 ghc is bundled in different rpms. This is what was missing: $ yum install ghc-ghc-devel $ yum install ghc-haskell-src-devel Patrick On Wed, Mar 2, 2011 at 7:50 AM, Patrick LeBoutillier <patrick.leboutill...@gmail.com> wrote: > Hi, > > I'm trying to install the plugins package on Fedora 14 but I get a > strange error: > > [patrickl@fc14x64 /]$ sudo cabal install plugins > Resolving dependencies... > cabal: cannot configure plugins-1.5.1.4. It requires ghc >=6.10 > There is no available version of ghc that satisfies >=6.10 > [patrickl@fc14x64 /]$ ghc --version > The Glorious Glasgow Haskell Compilation System, version 6.12.1 > > One thing probably worth mentioning is that my home directory is > shared amongst many servers, some running older Fedora versions (10). > Could something in my ~/.cabal be messed up or incompatible between versions? > > > Thanks, > > Patrick > > -- > ===================== > Patrick LeBoutillier > Rosem?re, Qu?bec, Canada > -- ===================== Patrick LeBoutillier Rosem?re, Qu?bec, Canada ------------------------------ Message: 2 Date: Wed, 02 Mar 2011 16:38:07 -0500 From: "Patrick Lynch" <kmandpjly...@verizon.net> Subject: Re: [Haskell-beginners] Monads To: "Brent Yorgey" <byor...@seas.upenn.edu>, <beginners@haskell.org> Message-ID: <D980060CA1E842F9841B040192B411DA@UserPC> Content-Type: text/plain; format=flowed; charset=iso-8859-1; reply-type=original ----- Original Message ----- From: "Brent Yorgey" <byor...@seas.upenn.edu> To: <beginners@haskell.org> Sent: Wednesday, March 02, 2011 10:37 AM Subject: Re: [Haskell-beginners] Monads > On Wed, Mar 02, 2011 at 10:04:38AM -0500, Patrick Lynch wrote: >> Daniel, >> Thank you...I understand now... >> Good day >> >> Ps >> I think my problem that I'm facing is that I don't see how the >> instance Functor Maybe is derived from the class Functor... >> >> for example, >> the author Miran Lipovaca gives the following: >> class Functor f where >> fmap::(a->b)->f a->f b >> >> if Maybe replaces f: >> fmap::(a->b)->Maybe a->Maybe b > > Right. > >> >> I don't see how the instance Functor Maybe is derived [presumably: >> 'f' is function (a->b) and not functor 'f' as shown in the class >> description): > > Yes, here 'f' is a function (a -> b). It is confusing that often the > letter f is used both to represent an arbitrary Functor or to > represent an arbitrary function. But you can tell the difference by > seeing whether the f occurs in a type or in some code. > >> instance Functor Maybe where >> fmap f (Just x) = Just (f x) >> fmap f Nothing = Nothing > > So you are confused about this code? Can you be more specific what > you are confused about? Try thinking carefully about all the types > involved. What is the type of f? (You already answered this: a -> b.) > What is the type of (Just x)? The type of x? What type is required on > the right hand side of the = ? And so on. >>> >>> >>>-Hi Brent >>>I know that Maybe type is: data Maybe a = Nothing | Just a >>>...so, I assume that the type to the right of the '=' should be Maybe a.. >>>...presumably, it should handle both Nothing and Just a >>>...so I can see: >>> instance Functor Maybe where >>> fmap Nothing = Nothing >>> fmap Just x = Just x >>>...presumably, x can be any type, eg Int, String, Char... >>>...so I don't see where 'f' comes from and I don't understand why (Just >>>x) is in parenthesis... >>>Thanks for your help, I'm beginning to see what I don't know... >>>Good evening, >>>-Pat >>> >>> > > -Brent > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners ------------------------------ Message: 3 Date: Thu, 3 Mar 2011 10:07:43 +1100 From: Jeff Lasslett <jeff.lassl...@gmail.com> Subject: Re: [Haskell-beginners] Understanding the type signature of flip$id To: Christian Maeder <christian.mae...@dfki.de> Cc: Beginners@haskell.org, Daniel Fischer <daniel.is.fisc...@googlemail.com> Message-ID: <aanlktiknvnqw61hxwyhyewvpsvunpag+e738z2jkk...@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Hi Christian, As a beginner I think it's easier to read the intention of 'flip ($)' rather than flip$id, where I found it used to resolve command line arguments. Thanks for that. Jeff On 2 March 2011 18:51, Christian Maeder <christian.mae...@dfki.de> wrote: > Maybe "flip ($)" is clearer? ($) is identity over function types. > > If you have the (first) argument you could use a section like "($ a)" > and avoid flip. > > C. > > Am 02.03.2011 06:33, schrieb Jeff Lasslett: >> Thanks Daniel, >> >> I think I follow what you've written. >> >> (b -> c) -> (b -> c) is the same as (b -> c) -> b > c >> >> and when that is flipped: b -> (b- > c) -> c >> >> Is that right? >> >> Thanks, >> Jeff >> >> >> >> On 2 March 2011 11:23, Daniel Fischer <daniel.is.fisc...@googlemail.com> >> wrote: >>> On Wednesday 02 March 2011 00:43:23, Jeff Lasslett wrote: >>>> ?I just don't understand how passing id to flip results in the >>>> following type signature: >>>> >>>> Prelude> :t flip$id >>>> flip$id :: b -> (b -> c) -> c >>>> >>>> I do understand what flip has done to map here:- >>>> >>>> Prelude> :t flip$map >>>> flip$map :: [a] -> (a -> b) -> [b] >>>> >>>> map take a function and a list and produces a new list. ?If map is >>>> passed to flip the result is a function that takes a list, then a >>>> function and results in a new list. >>>> >>>> How do we go from flip having this signature: >>>> >>>> Prelude> :t flip >>>> flip :: (a -> b -> c) -> b -> a -> c >>>> Prelude> >>>> >>>> and id having >>>> >>>> Prelude> :t id >>>> id :: a -> a >>>> Prelude> >>>> >>>> to flip$id looking like flip$id :: b -> (b -> c) -> c ? ??? >>>> >>>> Thanks, >>>> Jeff >>> >>> The point is that the type of id has to be unified with the type of flip's >>> (first) argument. >>> >>> flip :: (a -> b -> c) -> (b -> a -> c) >>> id :: t -> t >>> >>> So we have to unify (a -> b -> c) and (t -> t). Fully parenthesized, >>> a -> b -> c is a -> (b -> c). Now unification yields >>> >>> t = a >>> -- id's arg must have the same type as the flip's argument's arg >>> >>> and >>> >>> t = (b -> c) >>> -- id's result must have the same result as flip's argument's result >>> >>> From that follows a = (b -> c) and *id can be passed to flip only at a more >>> restricted type than id's most general type, namely at the type >>> id :: (b -> c) -> (b -> c)* >>> >>> So, >>> >>> flip (id :: (b -> c) -> b -> c) :: b -> (b -> c) -> c >>> >> > ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 33, Issue 3 ****************************************