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. Re: Compiling C into Haskell (Maciej Piechotka)
2. Re: Re: Compiling C into Haskell (matthew coolbeth)
3. Forcing evalation in the IO Monad (Philip Scott)
4. Re: calling polymorphic function in Selenium question (MH)
5. Re: Forcing evalation in the IO Monad (Heinrich Apfelmus)
6. Re: Re: Forcing evalation in the IO Monad (Daniel Fischer)
7. Re: Re: Forcing evalation in the IO Monad (Philip Scott)
----------------------------------------------------------------------
Message: 1
Date: Fri, 16 Apr 2010 11:43:28 +0200
From: Maciej Piechotka <[email protected]>
Subject: [Haskell-beginners] Re: Compiling C into Haskell
To: [email protected]
Message-ID: <1271411008.5587.76.ca...@picard>
Content-Type: text/plain; charset="utf-8"
On Fri, 2010-04-16 at 10:59 +0200, Maciej Piechotka wrote:
> > > I forgot to mention that, when using a screen reader, many users
> try to maximize their line width so, if reading by line, they can
> often get an entire paragraph with a single down arrow rather than
> reading through superfluously narrow lines which have two problems:
> 1. they require more keystrokes which 2. break up a user's
> concentration as the flow of sentences are broken up by needing to
> take action a every few words.
> > >
> >
>
> Depends on the logic of down key. Some editors make down key jump to
> corresponding visual line some corresponding real line.
Ups - I haven't read till the end. Modern software does not require
additional keystrokes every few lines but it can breaks automatically.
For example currently writing this mail I haven't presses enter so far
(no copy newline from another editor etc.). It automatically wraps the
line as I write.
I don't have to break my concentration - I just write. Even if I'm
inserting something in the middle it will automatically rewrap the whole
paragraph - there is no need for pressing enter manually or counting
characters.
Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
Url :
http://www.haskell.org/pipermail/beginners/attachments/20100416/47045915/attachment-0001.bin
------------------------------
Message: 2
Date: Fri, 16 Apr 2010 06:35:01 -0400
From: matthew coolbeth <[email protected]>
Subject: Re: [Haskell-beginners] Re: Compiling C into Haskell
To: Maciej Piechotka <[email protected]>
Cc: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="utf-8"
Can we move this to another mailing list, guys? We don't want to put anyone
off learning Haskell.
On Fri, Apr 16, 2010 at 05:43, Maciej Piechotka <[email protected]>wrote:
> On Fri, 2010-04-16 at 10:59 +0200, Maciej Piechotka wrote:
> > > > I forgot to mention that, when using a screen reader, many users
> > try to maximize their line width so, if reading by line, they can
> > often get an entire paragraph with a single down arrow rather than
> > reading through superfluously narrow lines which have two problems:
> > 1. they require more keystrokes which 2. break up a user's
> > concentration as the flow of sentences are broken up by needing to
> > take action a every few words.
> > > >
> > >
> >
> > Depends on the logic of down key. Some editors make down key jump to
> > corresponding visual line some corresponding real line.
>
> Ups - I haven't read till the end. Modern software does not require
> additional keystrokes every few lines but it can breaks automatically.
> For example currently writing this mail I haven't presses enter so far
> (no copy newline from another editor etc.). It automatically wraps the
> line as I write.
>
> I don't have to break my concentration - I just write. Even if I'm
> inserting something in the middle it will automatically rewrap the whole
> paragraph - there is no need for pressing enter manually or counting
> characters.
>
> Regards
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
--
mac
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.haskell.org/pipermail/beginners/attachments/20100416/4ff6f90c/attachment-0001.html
------------------------------
Message: 3
Date: Fri, 16 Apr 2010 14:40:17 +0100
From: Philip Scott <[email protected]>
Subject: [Haskell-beginners] Forcing evalation in the IO Monad
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi folks,
This question is so trivial it must have been answered before, but I
have been googling all morning to no avail so please bear with me. I've
been wading through mires of $! and seq, deepSeq, $!! etc.. and I have
leaned a lot of useful stuff about lazy evaluation - but I haven't been
able to solve my problem.. What I would like to do is to force an
expression to be fully evaluated to normal form, from inside the IO
monad, right there and then.
For example, in GHCI, calling putStrLn does just what I want:
Debug.Trace Prelude> let a = trace "Hello" 42
Debug.Trace Prelude> putStrLn $ show a
Hello
42
Except that it only takes showable things, and it puts an annoying
message on the screen.
What I want is something like putStrLn that doesn't print anything, and
takes any type as its input, evaluates it to normal form and then does
nothing else. It might be called something like 'evaluate' have a type
like this
evaluate :: a -> IO()
It _must_ exist - and it _must_ be easier to find this sort of thing
than I am making it, or else how did all you haskell gurus attain your
status? Am I missing something :)
All the best,
Philip
------------------------------
Message: 4
Date: Fri, 16 Apr 2010 10:20:43 -0400
From: MH <[email protected]>
Subject: [Haskell-beginners] Re: calling polymorphic function in
Selenium question
To: [email protected], Brent Yorgey <[email protected]>
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
I tried that and I got the following error:
A pattern type signature cannot bind scoped type variables `a'
unless the pattern has a rigid type context
In the pattern: x :: Selenium a -> IO (Either String a)
In a stmt of a 'do' expression:
(x :: Selenium a -> IO (Either String a)) <- start
"
https://www.google.com"
In the expression:
do { (x :: Selenium a -> IO (Either String a)) <- start "
https://www.google.com";
Then I tried to add "forall a" but the Selenium library doesn't use forall
so there was a conflict. Is there a way to work around the rigid type error
you know of?
Thanks
On Apr 15, 3:14 pm, Brent Yorgey <[email protected]> wrote:
> On Sun, Apr 04, 2010 at 09:25:16PM -0400, MH wrote:
> > I am running the following code that is using Selenium. If you look at
> > the function "start", you will see that the return type of the
> > function is polymorphic. Now in main function, I call start function
> > to get selenium IO monad and sequentially call selenium commands
> > (open, doCommand etc...). The problem that I have here is, while I can
> > call all Selenium commands with signature (String -> Selenium
> > String), I can't call commands with signature (String -> Selenium
> > Bool). As I understand it, even though "start" function shall return
> > IO (Selenium a -> IO (Either String a)), it actually return IO
> > (Selenium String -> IO (Either String String)).
>
> Hmm, I must confess that I don't understand exactly what is going on
> here. One thing to try is to give an explicit type annotation at
> start's call site, something like
>
> > main = do
> > (selenium :: Selenium a -> IO (Either String a)) <- start "
http://www.google.com"
> > selenium $ open "/"
> > selenium $ doCommand SWindowMaximize []
> > selenium $ typeText (Name "q") "stuff"
> > selenium $ clickAndWait (Name "btnG")
> > return selenium
>
> Does that help?
>
> -Brent
> _______________________________________________
> Beginners mailing list
> [email protected]http://www.haskell.org/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.haskell.org/pipermail/beginners/attachments/20100416/3cbc91cf/attachment-0001.html
------------------------------
Message: 5
Date: Fri, 16 Apr 2010 16:25:08 +0200
From: Heinrich Apfelmus <[email protected]>
Subject: [Haskell-beginners] Re: Forcing evalation in the IO Monad
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8
Philip Scott wrote:
>
> What I want is something like putStrLn that doesn't print anything, and
> takes any type as its input, evaluates it to normal form and then does
> nothing else. It might be called something like 'evaluate' have a type
> like this
>
> evaluate :: a -> IO()
With Hoogle, you can search for types:
http://haskell.org/hoogle/?hoogle=a+-%3E+IO+%28%29
12th result from the top.
Regards,
Heinrich Apfelmus
--
http://apfelmus.nfshost.com
------------------------------
Message: 6
Date: Fri, 16 Apr 2010 16:37:56 +0200
From: Daniel Fischer <[email protected]>
Subject: Re: [Haskell-beginners] Re: Forcing evalation in the IO Monad
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"
Am Freitag 16 April 2010 16:25:08 schrieb Heinrich Apfelmus:
> Philip Scott wrote:
> > What I want is something like putStrLn that doesn't print anything,
> > and takes any type as its input, evaluates it to normal form and then
> > does nothing else. It might be called something like 'evaluate' have a
> > type like this
> >
> > evaluate :: a -> IO()
>
> With Hoogle, you can search for types:
>
> http://haskell.org/hoogle/?hoogle=a+-%3E+IO+%28%29
>
> 12th result from the top.
That evaluates only to WHNF.
Control.DeepSeq.rnf seems to be closer, but requires NFData instances.
>
>
> Regards,
> Heinrich Apfelmus
------------------------------
Message: 7
Date: Fri, 16 Apr 2010 16:00:57 +0100
From: Philip Scott <[email protected]>
Subject: Re: [Haskell-beginners] Re: Forcing evalation in the IO Monad
To: Daniel Fischer <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed
Daniel Fischer wrote:
> Am Freitag 16 April 2010 16:25:08 schrieb Heinrich Apfelmus:
>
>> Philip Scott wrote:
>>
>>> What I want is something like putStrLn that doesn't print anything,
>>> and takes any type as its input, evaluates it to normal form and then
>>> does nothing else. It might be called something like 'evaluate' have a
>>> type like this
>>>
>>> evaluate :: a -> IO()
>>>
>> With Hoogle, you can search for types:
>>
>> http://haskell.org/hoogle/?hoogle=a+-%3E+IO+%28%29
>>
>> 12th result from the top.
>>
>
> That evaluates only to WHNF.
>
> Control.DeepSeq.rnf seems to be closer, but requires NFData instances.
>
>
The documentation says that, but it does appear to go deeper than just
one level:
Debug.Trace Prelude Control.Exception> let a = trace "Hello" 42
Debug.Trace Prelude Control.Exception> let b = trace "Frank" (a * 2)
Debug.Trace Prelude Control.Exception> evaluate b
Frank
Hello
84
Perhaps it specifies WHNF in case you 'evaluate' something which doesn't
have a HNF (like a partially applied function?).
- Philip
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 22, Issue 24
*****************************************