[Haskell-beginners] Beginners Digest, Vol 108, Issue 12

Ning Yin yin.137 at gmail.com
Wed Jun 28 05:39:28 UTC 2017



发自我的 iPad

> 在 2017年6月24日,20:00,beginners-request at haskell.org 写道:
> 
> Send Beginners mailing list submissions to
>    beginners at 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-request at haskell.org
> 
> You can reach the person managing the list at
>    beginners-owner at 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:  help designing types for a gsl fit (David McBride)
>   2.  What to use when you need random values? (Silent Leaf)
>   3. Re:  What to use when you need random values? (David McBride)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Fri, 23 Jun 2017 09:58:35 -0400
> From: David McBride <toad3k at gmail.com>
> To: The Haskell-Beginners Mailing List - Discussion of primarily
>    beginner-level topics related to Haskell <beginners at haskell.org>
> Subject: Re: [Haskell-beginners] help designing types for a gsl fit
> Message-ID:
>    <CAN+Tr42LkXcggzKVfzcsmXuK79t39F36_eNa4CWDmP1PX_gqHw at mail.gmail.com>
> Content-Type: text/plain; charset="UTF-8"
> 
> If you look at the type of labelNew
> 
> GlibString string => Maybe string -> IO Label
> 
> If you look at the instances for GlibString, they could be Text or
> [Char].  You have to decide which.  The fact that you are using
> Nothing does not tell you the entire final type.  It could be Maybe
> [Char], or Maybe Text.  Even though the choice seems arbitrary in this
> instance, you have to decide which it is.  So try this.
> 
> lprog <- G.labelNew (Nothing :: Maybe [Char])
> 
> On Fri, Jun 23, 2017 at 3:22 AM, Agustin Larreinegabe
> <alarreine at gmail.com> wrote:
>> Hello,
>> I'm trying to install an application Termite - Debug but I get this error in
>> line 929:14
>> 
>> when it try to do this
>> 
>> 
>> 
>>             lprog <- G.labelNew Nothing
>> 
>> 
>> The error says:
>> 
>> Could not deduce (glib-0.13.4.1:System.Glib.UTFString.GlibString string0)
>> arising from a use of ‘G.labelNew’ from the context (D.Rel c v a s) bound by
>> the type signature for sourceWindowCreate :: D.Rel c v a s => RSourceView c
>> a u -> IO G.Widget at Debug/SourceView.hs:913:23-73 instance
>> glib-0.13.4.1:System.Glib.UTFString.GlibString [Char] -- Defined in
>> ‘glib-0.13.4.1:System.Glib.UTFString’ In a stmt of a 'do' block: lprog <-
>> G.labelNew Nothing In the expression: do { vbox <- G.vBoxNew False 0;
>> G.widgetShow vbox; spec <- getIORef svInputSpec ref; code <- codeWinNew
>> spec; .... } In an equation for ‘sourceWindowCreate’: sourceWindowCreate ref
>> = do { vbox <- G.vBoxNew False 0; G.widgetShow vbox; spec <- getIORef
>> svInputSpec ref; cabal: Error: some packages failed to install:
>> 
>> I really don't know how to proceed, I'm new with Haskell
>> 
>> 
>> Thanks in advance.
>> 
>> 
>> -----------------
>> Agustin Larreinegabe
>> 
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Fri, 23 Jun 2017 16:24:07 +0200
> From: Silent Leaf <silent.leaf0 at gmail.com>
> To: The Haskell-Beginners Mailing List - Discussion of primarily
>    beginner-level topics related to Haskell <beginners at haskell.org>
> Subject: [Haskell-beginners] What to use when you need random values?
> Message-ID:
>    <CAGFccjP6ai7x_n9+AGQGGgjGAMWtqOU-+YNSUbDHAEN4Sp+wNA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> Hi,
> I've had trouble finding the best way(s) to use random values in haskell,
> as it seems like there are several modules that either do the same thing or
> reuse one another i'm not sure.
> 
> There is System.Random
> - is it better to use the streams random(R)s or a more imperative randomRIO?
> - is it better to use mkStdGen or newStdGen or getStdGen?
> There is Test.QuickCheck and its type(class?) Gen
> There is a module in Control.Monad (i think) which exports the type Rnd
> 
> What about performances, and all those options? What do you like to use
> with random numbers?
> 
> I know that's a lot of questions. feel free to only answer to a few of
> them. :)
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mail.haskell.org/pipermail/beginners/attachments/20170623/8fdc7829/attachment-0001.html>
> 
> ------------------------------
> 
> Message: 3
> Date: Fri, 23 Jun 2017 11:10:05 -0400
> From: David McBride <toad3k at gmail.com>
> To: The Haskell-Beginners Mailing List - Discussion of primarily
>    beginner-level topics related to Haskell <beginners at haskell.org>
> Subject: Re: [Haskell-beginners] What to use when you need random
>    values?
> Message-ID:
>    <CAN+Tr43UcOVbES4Sw9BdhuYuu-iYekc2nsCxT0tx5nKp2uTM=g at mail.gmail.com>
> Content-Type: text/plain; charset="UTF-8"
> 
> When you are unsure about the differences between functions, it can be
> good to read the haddocks for the library.
> 
> http://hackage.haskell.org/package/random-1.1/docs/System-Random.html
> 
> The standard haskell random library supports the idea of splitting a
> seed randomly.  You take one seed and split it, and now you  have two
> seeds, which will each generate different randoms independently.
> getStdGen gets the current global seed.  newStdGen splits new a seed
> off of the current global seed.  mkStdGen allows you to create a seed
> from a value so that you can get the same set of randoms repeatedly.
> 
> I would say if you are in IO, just use randomRIO.  If you are in
> monadic code that not IO at its base, you should use MonadRandom
> library on hackage.  Quickcheck randomness is only really used in
> quickcheck, although it is probably based off the standard libraries.
> 
> Just keep in mind that randomness is a concept that is a little hard
> to wrap your head around in haskell until you've been using it a
> little while.
> 
>> On Fri, Jun 23, 2017 at 10:24 AM, Silent Leaf <silent.leaf0 at gmail.com> wrote:
>> Hi,
>> I've had trouble finding the best way(s) to use random values in haskell, as
>> it seems like there are several modules that either do the same thing or
>> reuse one another i'm not sure.
>> 
>> There is System.Random
>> - is it better to use the streams random(R)s or a more imperative randomRIO?
>> - is it better to use mkStdGen or newStdGen or getStdGen?
>> There is Test.QuickCheck and its type(class?) Gen
>> There is a module in Control.Monad (i think) which exports the type Rnd
>> 
>> What about performances, and all those options? What do you like to use with
>> random numbers?
>> 
>> I know that's a lot of questions. feel free to only answer to a few of them.
>> :)
>> 
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
> 
> 
> ------------------------------
> 
> Subject: Digest Footer
> 
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
> 
> 
> ------------------------------
> 
> End of Beginners Digest, Vol 108, Issue 12
> ******************************************


More information about the Beginners mailing list