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:  Beginners Digest, Vol 108, Issue 12 (Ning Yin)
   2. Re:  a way to check whether a file is actually being written
      on (Silent Leaf)
   3. Re:  Improve my lambda expressions (Frerich Raabe)


----------------------------------------------------------------------

Message: 1
Date: Wed, 28 Jun 2017 13:39:28 +0800
From: Ning Yin <yin....@gmail.com>
To: "beginners@haskell.org" <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Beginners Digest, Vol 108, Issue 12
Message-ID: <d6f3ea63-c1ac-45d8-aed8-566a3d6f7...@gmail.com>
Content-Type: text/plain;       charset=gb2312



发自我的 iPad

> 在 2017年6月24日,20:00,beginners-requ...@haskell.org 写道:
> 
> 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:  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 <toa...@gmail.com>
> To: The Haskell-Beginners Mailing List - Discussion of primarily
>    beginner-level topics related to Haskell <beginners@haskell.org>
> Subject: Re: [Haskell-beginners] help designing types for a gsl fit
> Message-ID:
>    <can+tr42lkxcggzkvfzcsmxuk79t39f36_ena4cwdmp1px_g...@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
> <alarre...@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@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.le...@gmail.com>
> To: The Haskell-Beginners Mailing List - Discussion of primarily
>    beginner-level topics related to Haskell <beginners@haskell.org>
> Subject: [Haskell-beginners] What to use when you need random values?
> Message-ID:
>    <cagfccjp6ai7x_n9+agqgggjgamwtqou-+ynsubdhaen4sp+...@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 <toa...@gmail.com>
> To: The Haskell-Beginners Mailing List - Discussion of primarily
>    beginner-level topics related to Haskell <beginners@haskell.org>
> Subject: Re: [Haskell-beginners] What to use when you need random
>    values?
> Message-ID:
>    <CAN+Tr43UcOVbES4Sw9BdhuYuu-iYekc2nsCxT0tx5nKp2uTM=g...@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.le...@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@haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
> 
> 
> ------------------------------
> 
> Subject: Digest Footer
> 
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
> 
> 
> ------------------------------
> 
> End of Beginners Digest, Vol 108, Issue 12
> ******************************************


------------------------------

Message: 2
Date: Wed, 28 Jun 2017 08:07:19 +0200
From: Silent Leaf <silent.le...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] a way to check whether a file is
        actually being written on
Message-ID:
        <CAGFccjNhycqAS358oWL=ypfltzqyxsukdp-kcmmcsdyzxap...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

strace sounds really great, i'll test it, thanks :)

2017-06-27 22:42 GMT+02:00 Jona Ekenberg <saik...@gmail.com>:

>
>
> Den 27 juni 2017 9:47 em skrev "Silent Leaf" <silent.le...@gmail.com>:
>
> Hi,
>
> i created a small clone of dd in haskell. I made it so it only copies
> block by block and only if there's any difference between each pair of
> blocks from each file. the idea is to use this dd clone as backup system,
> especially since my partitions are nearly full, so no real loss in copying
> the whole things.
>
> I'm wondering if there's any way to check if my program never ever writes
> onto the target unless actually needed. obviously by reading the code i'd
> say it does what i want, but we do make test cases rather than rely on what
> we think the code does.
>
> i can't run it with a target file that would be made read-only in the
> filesys (and hope for an error for trying to write on it) since obviously i
> need to open it in read-write right from the beginning, in case of actual
> need of writing (as apparently i can't have two handles on the same file...
> although maybe there's a way to change the mode of opening on the run? did
> not find it in System.IO nor in Hoogle or Hayoo)
>
> so if anyone has an idea, in or outside of haskell, that would be great!
> ______________________________
>
> Maybe you can use strace? https://youtu.be/4pEHfGKB-OE
>
>
> 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/20170628/08ffecef/attachment-0001.html>

------------------------------

Message: 3
Date: Wed, 28 Jun 2017 08:26:20 +0200
From: Frerich Raabe <ra...@froglogic.com>
To: patrick.bro...@dit.ie, The Haskell-Beginners Mailing List -
        Discussion of primarily beginner-level topics related to Haskell
        <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Improve my lambda expressions
Message-ID: <2b58f301f228aa26ba3d26c11ee34...@froglogic.com>
Content-Type: text/plain; charset=US-ASCII; format=flowed

On 2017-06-27 18:35, PATRICK BROWNE wrote:
> Thanks for all your help.
> I was unaware that there was a relation between let/where and lambdas.
> Here is my effort to use a single lamda
> md3 n = (\n -> (dist  (Point (4.0 + 0.5 * n) (4.0 - 0.5 * n)) (Point (n * 
> 1.0) ( n * (-1.0))))) n
> 
> I imagine that this function could be written without lambdas, let, or 
> where.

Indeed, it could. Note that your definition has the form

   md3 n = (\n -> (dist )) n

I.e. the expression 'md3 n' is equivalent to the expression '(\n -> (dist 
..)) n', which means 'apply the lambda expression to n'. You don't need the 
lambda expression if you apply it to a given argument directly though, i.e. 
the above definition is equivalent to

   md3 n = dist ..

> Is it generally true the all/most functions could be written without 
> lambdas, let, or where?

I believe it is true since you could define any function as a global 
definition (i.e. not a nested scope as in let..in or where).

-- 
Frerich Raabe - ra...@froglogic.com
www.froglogic.com - Multi-Platform GUI Testing


------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 108, Issue 21
******************************************

Reply via email to