Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.haskell.org/cgi-bin/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: Grappling with State Monad get (Olumide) 2. Re: Libraries for Playing Audio (Atrudyjane) 3. Re: Grappling with State Monad get (Theodore Lief Gannon) ---------------------------------------------------------------------- Message: 1 Date: Wed, 2 Aug 2017 01:13:12 +0100 From: Olumide <50...@web.de> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] Grappling with State Monad get Message-ID: <857c118a-34a4-20c0-5414-719eb88b0...@web.de> Content-Type: text/plain; charset=utf-8; format=flowed Of course 's' is not a type variable as its lowercase. Therefore, get is a monad 'constructed' by the state function, correct? So, in the do notation the lambda is extracted and used as per the definition of bind. The context of which we speak therefore must derive from the next expression(?) in the do notation, which is somewhat confusing to determine in the example stackyStack :: State Stack () stackyStack = do stackNow <- get if stackNow == [1,2,3] then put [8,3,1] else put [9,2,1] Regards, - Olumide On 02/08/17 00:35, Theodore Lief Gannon wrote: > 's' here is not a type variable, it's an actual variable. \s -> (s, s) > defines a lambda function which takes any value, and returns a tuple > with that value in both positions. > > So yes, get is point-free, but the missing argument is right there > in-line. And yes, its type is simply implied from context. > > > On Aug 1, 2017 4:17 PM, "Olumide" <50...@web.de <mailto:50...@web.de>> > wrote: > > Ahoy Haskellers, > > In the section "Getting and Setting State" > (http://learnyouahaskell.com/for-a-few-monads-more#state > <http://learnyouahaskell.com/for-a-few-monads-more#state>) in LYH > get is defined as > > get = state $ \s -> (s, s) > > How does does get determine the type s, is considering that it has > no argument as per the definition given above? Or is the definition > written in some sort of point-free notation where an argument has > been dropped? > > I find the line stackNow <- get in the the function(?) stackyStack > confusing for the same reason. I guess my difficulty is that state $ > \s ->(s , s) has a generic type (s) whereas the stackyStack has a > concrete type. Is the type of s determined from the type of the > stateful computation/do notation? > > Regards, > > - Olumide > _______________________________________________ > Beginners mailing list > Beginners@haskell.org <mailto:Beginners@haskell.org> > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > <http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners> > > > > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > ------------------------------ Message: 2 Date: Tue, 01 Aug 2017 21:23:59 -0400 From: Atrudyjane <atrudyj...@protonmail.com> To: Oliver Charles <ol...@ocharles.org.uk> Cc: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] Libraries for Playing Audio Message-ID: <FPuYdOyGakdgfmnGxyJgCIGCkaMZgcARB3C9152I1GfRtRppGlSsaeLbcn27-CBUPMMbnMkp7qqz38UWvhkYjrol5zZ_hz80eTDOC-x_NG0=@protonmail.com> Content-Type: text/plain; charset="utf-8" Hi Oliver, The requirements are to play, pause play, and stop playing an mp3 file. Also would like to use time elapsed and duration data. Andrea Sent with [ProtonMail](https://protonmail.com) Secure Email. > -------- Original Message -------- > Subject: Re: [Haskell-beginners] Libraries for Playing Audio > Local Time: August 1, 2017 4:01 AM > UTC Time: August 1, 2017 9:01 AM > From: ol...@ocharles.org.uk > To: Atrudyjane <atrudyj...@protonmail.com>, The Haskell-Beginners Mailing > List - Discussion of primarily beginner-level topics related to Haskell > <beginners@haskell.org>, i...@maximka.de <i...@maximka.de> > What are your requirements? SDL2's audio module is functional, but I don't > know if it's sufficient for what you're looking for. > > On Tue, Aug 1, 2017 at 3:44 AM Atrudyjane <atrudyj...@protonmail.com> wrote: > >> Thanks Alexei, >> Think I've narrowed it down to either sox or conduit-audio. Looks like >> SDL-mixer hasn't been updated in a while and it has an 'All reported builds >> failed' status as of 2015. >> Regards, >> Andrea >> >> Sent with [ProtonMail](https://protonmail.com) Secure Email. >> >>> -------- Original Message -------- >>> Subject: Re: [Haskell-beginners] Libraries for Playing Audio >>> Local Time: July 31, 2017 12:50 AM >>> UTC Time: July 31, 2017 5:50 AM >>> From: i...@maximka.de >>> To: Atrudyjane <atrudyj...@protonmail.com>, The Haskell-Beginners Mailing >>> List - Discussion of primarily beginner-level topics related to Haskell >>> <beginners@haskell.org> >>> There is haskell wrapper for powerful sox availiable also. >>> http://hackage.haskell.org/package/sox >>> Alexei >>>> On 31 July 2017 at 07:09 Atrudyjane <atrudyj...@protonmail.com> wrote: >>>> >>>> >>>> Hello Cafe, >>>> Is there a recommended Haskell library for playing/manipulating audio >>>> files? There"s a long list of sound libraries on Hackage, and was thinking >>>> looking into either conduit-audio or SDL-mixer. >>>> Thank You, >>>> Andrea >>>> >>>> Sent with [ProtonMail](https://protonmail.com) Secure >>>> Email._______________________________________________ >>>> Beginners mailing list >>>> Beginners@haskell.org >>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners >> >> _______________________________________________ >> Beginners mailing list >> Beginners@haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20170801/ec5c32df/attachment-0001.html> ------------------------------ Message: 3 Date: Tue, 1 Aug 2017 19:26:57 -0700 From: Theodore Lief Gannon <tan...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] Grappling with State Monad get Message-ID: <cajopsud6ajw9bcmsipjmyucv8dli_f1pqny4y1c+p5spkz+...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Actually, get is constrained immediately to be State Stack Stack. If later statements tried to use it as something else, it would be a type error. The types in a do block can only vary in their final parameter. The type of stackyStack is State Stack (), so in that do block all the statements must be forall a. State Stack a. Now, check the type of get in GHCi: get :: State a a We know that the first type parameter here is Stack, and the second position is the same type, thus State Stack Stack. On Tue, Aug 1, 2017 at 5:13 PM, Olumide <50...@web.de> wrote: > Of course 's' is not a type variable as its lowercase. > > Therefore, get is a monad 'constructed' by the state function, correct? > > So, in the do notation the lambda is extracted and used as per the > definition of bind. The context of which we speak therefore must derive > from the next expression(?) in the do notation, which is somewhat confusing > to determine in the example > > stackyStack :: State Stack () > stackyStack = do > stackNow <- get > if stackNow == [1,2,3] > then put [8,3,1] > else put [9,2,1] > > Regards, > > - Olumide > > On 02/08/17 00:35, Theodore Lief Gannon wrote: > >> 's' here is not a type variable, it's an actual variable. \s -> (s, s) >> defines a lambda function which takes any value, and returns a tuple with >> that value in both positions. >> >> So yes, get is point-free, but the missing argument is right there >> in-line. And yes, its type is simply implied from context. >> >> >> On Aug 1, 2017 4:17 PM, "Olumide" <50...@web.de <mailto:50...@web.de>> >> wrote: >> >> Ahoy Haskellers, >> >> In the section "Getting and Setting State" >> (http://learnyouahaskell.com/for-a-few-monads-more#state >> <http://learnyouahaskell.com/for-a-few-monads-more#state>) in LYH >> get is defined as >> >> get = state $ \s -> (s, s) >> >> How does does get determine the type s, is considering that it has >> no argument as per the definition given above? Or is the definition >> written in some sort of point-free notation where an argument has >> been dropped? >> >> I find the line stackNow <- get in the the function(?) stackyStack >> confusing for the same reason. I guess my difficulty is that state $ >> \s ->(s , s) has a generic type (s) whereas the stackyStack has a >> concrete type. Is the type of s determined from the type of the >> stateful computation/do notation? >> >> Regards, >> >> - Olumide >> _______________________________________________ >> Beginners mailing list >> Beginners@haskell.org <mailto:Beginners@haskell.org> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners >> <http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners> >> >> >> >> >> _______________________________________________ >> Beginners mailing list >> Beginners@haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners >> >> _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20170801/3d70afd3/attachment.html> ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 110, Issue 4 *****************************************