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.  Can I set Cabal conditional options for all      build targets
      (Dimitri DeFigueiredo)
   2. Re:  Finding Keith Numbers with Haskell (Rein Henrichs)
   3. Re:  Finding Keith Numbers with Haskell (Alexander Berntsen)


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

Message: 1
Date: Tue, 11 Nov 2014 17:47:11 -0700
From: Dimitri DeFigueiredo <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] Can I set Cabal conditional options for
        all     build targets
Message-ID: <[email protected]>
Content-Type: text/plain; charset=windows-1252; format=flowed

Hi,

Is there a way to set a conditional in a .cabal file that applies to all 
the build targets in the file?
I have many build targets and repeating the conditional for each of them 
doesn't make sense.
But I get an error message when doing that.

For example, I can do this in my example.cabal file:
----
name:                MyExample

build-type:          Simple

-- the conditional flag I want to use
Flag production
   Description: Attempts to get production env
   Default:     True

executable client
   main-is:             client.hs

   if flag(production)
     CPP-Options: -DPRODUCTION

executable server
   main-is:             server.hs

   if flag(production)
     CPP-Options: -DPRODUCTION

------
So I have to specify the options once per target. I get an error message 
if I move the "if flag(production)" outside an "executable" block. And 
the docs "seem to indicate" that's not possible.

Thanks,

Dimitri

PS. I'm using cabal "1.20.0.3"



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

Message: 2
Date: Tue, 11 Nov 2014 17:44:45 -0800
From: Rein Henrichs <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Finding Keith Numbers with Haskell
Message-ID:
        <cajp6g8xh+wtbzaasm0zk7e8zwa8upcw_zmaauaswq_pn8ew...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Tue, Nov 11, 2014 at 5:26 AM, Jack Mott <[email protected]> wrote:

> I did try this approach as well, reversing the digits and adding elements
> to the head, however having to use take and letting the list build  up
> larger seems to result in slightly worse performance overall.
>

The list doesn't build up. The specification for Keith Numbers requires
that we only sum the previous n numbers, where n is the length of the
decimal encoding of the given number, so we always truncate using take
before the recursive call.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20141111/45603ef3/attachment-0001.html>

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

Message: 3
Date: Wed, 12 Nov 2014 10:07:03 +0100
From: Alexander Berntsen <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Finding Keith Numbers with Haskell
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 11/11/14 16:17, Kim-Ee Yeoh wrote:
> On Tue, Nov 11, 2014 at 8:26 PM, Jack Mott <[email protected]> 
> wrote:
> 
>> Thanks, is the notation with the single quote (isKeith') a 
>> convention for helper functions or does it actually change 
>> something about the program?
> 
> 
> An unspoken coding convention.
> 
> Function foo' would be read "foo-prime". E.g.of usage:
> haskell-prime is the next standard of haskell, which became moot
> because you need good vibes for diverse peoples to collaborate on
> such an undertaking, including supporting it by writing more than
> one implementation.
> 
> Strictly syntax, the compiler doesn't treat it differently from
> any other name label.
> 
> So yes, you could have foo-double-prime and so forth.
It's inherited from maths (like everything else). Very commonly used
for a changed/new version of something. Comes up a lot in games
programming. One banal example:

update :: World -> World
update (World p p2 b e) =
  let p'  = update p
      p2' = update p2
      b'  = update b
      e'  = update e
  in  World p' p2' b' e'
  where update = draw . move . react
- -- 
Alexander
[email protected]
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlRjIzcACgkQRtClrXBQc7WPHwEAuIDb/vALYJ6Duz2ZDdB/tqHs
l35idQYgOkngDrVe4pwA/0PcF4IUv8MwBAOI3kE8OiBDFTPhsS2SlRtmgihqXwty
=XyN/
-----END PGP SIGNATURE-----


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

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


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

End of Beginners Digest, Vol 77, Issue 13
*****************************************

Reply via email to