Gmail Calendar Documents Web Reader more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Types with state monad?
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.

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