Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Types with state monad?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
daucl...@gmail.com  
View profile  
 More options Nov 13 2007, 11:36 am
Newsgroups: comp.lang.haskell
From: daucl...@gmail.com
Date: Tue, 13 Nov 2007 08:36:35 -0800
Local: Tues, Nov 13 2007 11:36 am
Subject: Types with state monad?
Hi!  I just finished reading the "Man or Boy" post and wished to make
the example Haskell program a bit briefer with the following change:

yo :: Integer -> [S s] -> S s
yo k (x1:x2:x3:x4:x5:[]) = a k x1 x2 x3 x4 x5

and with that the new run is

run' k = runST (yo k (map return [1 (-1) (-1) 1 0]))

(instead of the original where the list argument is laid out as
curried individuals).

where type S s = ST s Integer

-----

The compiler complains that:

    No instance for (Num (a -> a1 -> t -> t1 -> Integer))
      arising from the literal `1'
      at /Users/dauclair/projects/haskell/eclipse/Tasty/src/
ManOrBoy.hs:25:34-48
    Possible fix:
      add an instance declaration for
      (Num (a -> a1 -> t -> t1 -> Integer))
    In the expression: 1 (- 1) (- 1) 1 0
    In the second argument of `map', namely `[1 (- 1) (- 1) 1 0]'
    In the second argument of `yo', namely
        `(map return [1 (- 1) (- 1) 1 0])'

-----

So, how is it that a list of the lifted integers is different than
individually lifted integers, type-wise?  How can the list elements be
properly lifted to their stateful equivalents?  I'm using ghc-6.6.1

Sincerely,
Doug Auclair


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lutz Donnerhacke  
View profile  
 More options Nov 13 2007, 11:51 am
Newsgroups: comp.lang.haskell
From: Lutz Donnerhacke <l...@iks-jena.de>
Date: Tue, 13 Nov 2007 16:51:48 +0000 (UTC)
Local: Tues, Nov 13 2007 11:51 am
Subject: Re: Types with state monad?

* daucl...@gmail.com wrote:
> run' k = runST (yo k (map return [1 (-1) (-1) 1 0]))

List elements are seperated by commata in Haskell.

    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
daucl...@gmail.com  
View profile  
 More options Nov 13 2007, 11:57 am
Newsgroups: comp.lang.haskell
From: daucl...@gmail.com
Date: Tue, 13 Nov 2007 08:57:49 -0800
Local: Tues, Nov 13 2007 11:57 am
Subject: Re: Types with state monad?
On Nov 13, 11:51 am, Lutz Donnerhacke <l...@iks-jena.de> wrote:

> * daucl...@gmail.com wrote:
> > run' k = runST (yo k (map return [1 (-1) (-1) 1 0]))

> List elements are seperated by commata in Haskell.

*sigh* But of course!  How embarrassing!  Thanks for the help.  Sorry
for the vacuous post.

Doug Auclair


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google