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: on (Erlend Hamberg)
2. Re: on (Ivan Uemlianin)
3. Re: High precision doubles
(Rafael Gustavo da Cunha Pereira Pinto)
4. Re: if True than let... (Heinrich Apfelmus)
5. Re: Re: if True than let... (Andrew Wagner)
6. Gtk2Hs and Cairo on Windows (Philippe D.-P.)
7. Re: Gtk2Hs and Cairo on Windows (Maur??cio)
8. Re: [Haskell-cafe] What is an "expected type" ... (Joe Fredette)
----------------------------------------------------------------------
Message: 1
Date: Fri, 26 Jun 2009 11:24:24 +0200
From: Erlend Hamberg <[email protected]>
Subject: Re: [Haskell-beginners] on
To: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
2009/6/26 Ivan Uemlianin <[email protected]>:
> My question is: what is "on"?
> I'm afraid I haven't been able to find anything about this, no doubt because
> of all the false positives coming up in searches.
http://www.haskell.org/hoogle/?hoogle=on
--
Erlend Hamberg
[email protected]
------------------------------
Message: 2
Date: Fri, 26 Jun 2009 10:27:47 +0100
From: Ivan Uemlianin <[email protected]>
Subject: Re: [Haskell-beginners] on
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Erlend Hamberg wrote:
> 2009/6/26 Ivan Uemlianin <[email protected]>:
>
>> My question is: what is "on"?
>> I'm afraid I haven't been able to find anything about this, no doubt because
>> of all the false positives coming up in searches.
>>
>
> http://www.haskell.org/hoogle/?hoogle=on
>
Wow that was fast!
Thanks, I hadn't tried Hoogle before and what I needed was the top hit:
http://haskell.org/ghc/docs/latest/html/libraries/base/Data-Function.html#v%3Aon
Ivan
--
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development
[email protected]
www.llaisdy.com
llaisdy.wordpress.com
www.linkedin.com/in/ivanuemlianin
"Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
(Schiller, Beethoven)
============================================================
------------------------------
Message: 3
Date: Fri, 26 Jun 2009 07:52:03 -0300
From: Rafael Gustavo da Cunha Pereira Pinto
<[email protected]>
Subject: Re: [Haskell-beginners] High precision doubles
To: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
Point noted, it doesn't seem to be the case for the original question, as he
is doing some square roots.
On Fri, Jun 26, 2009 at 04:00, <[email protected]> wrote:
> G'day all.
>
> Quoting Rafael Gustavo da Cunha Pereira Pinto <[email protected]
> >:
>
> I am reading this and still don't understand what is the question. You
>> should never operate two floating point numbers expecting to result zero.
>> Period.
>>
>
> WARNING: Advanced material follows.
>
> A 32-bit integer fits losslessly in the mantissa of a Double. Any of
> the basic integer operations which work correctly on 32-bit integers
> must also work correctly when that integer is stored in a Double. You
> are allowed to assume this.
>
> Cheers,
> Andrew Bromage
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
--
Rafael Gustavo da Cunha Pereira Pinto
Electronic Engineer, MSc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.haskell.org/pipermail/beginners/attachments/20090626/7ab78cc4/attachment-0001.html
------------------------------
Message: 4
Date: Fri, 26 Jun 2009 13:30:22 +0200
From: Heinrich Apfelmus <[email protected]>
Subject: [Haskell-beginners] Re: if True than let...
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
Andrew Wagner wrote:
> Try this: let b = if a == True then "+" else "-" in ...
The little figurine of Dijkstra in my head is urging me to write this as
let b = if a then "+" else "-" in ...
instead. ;)
Regards,
apfelmus
--
http://apfelmus.nfshost.com
------------------------------
Message: 5
Date: Fri, 26 Jun 2009 08:50:40 -0400
From: Andrew Wagner <[email protected]>
Subject: Re: [Haskell-beginners] Re: if True than let...
To: Heinrich Apfelmus <[email protected]>
Cc: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
Well sure. I was assuming it was a simplified example...
On Fri, Jun 26, 2009 at 7:30 AM, Heinrich Apfelmus <
[email protected]> wrote:
> Andrew Wagner wrote:
> > Try this: let b = if a == True then "+" else "-" in ...
>
> The little figurine of Dijkstra in my head is urging me to write this as
>
> let b = if a then "+" else "-" in ...
>
> instead. ;)
>
>
> Regards,
> apfelmus
>
> --
> http://apfelmus.nfshost.com
>
> _______________________________________________
> 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/20090626/5e73562a/attachment-0001.html
------------------------------
Message: 6
Date: Fri, 26 Jun 2009 21:51:53 -0400
From: "Philippe D.-P." <[email protected]>
Subject: [Haskell-beginners] Gtk2Hs and Cairo on Windows
To: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
Hello,
I would like to use Haskell with Gtk2Hs/Cairo for a project, but I have
trouble making it work on Windows. I've installed the lastest GHC + Gtk2Hs
and I tried to copy/paste the code from examples on this tutorial
http://darcs.haskell.org/gtk2hs/docs/tutorial/Tutorial_Port/app1.xhtml.
On linux; no problem.
But for some reason I get a "not in scope: `eventSent`" error on Windows and
I can't compile.
How can I solve the problem and, more importantly, is it possible to write
portable code with Gtk2Hs/Cairo ?
Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.haskell.org/pipermail/beginners/attachments/20090626/198c8880/attachment-0001.html
------------------------------
Message: 7
Date: Fri, 26 Jun 2009 23:40:56 -0300
From: Maur??cio <[email protected]>
Subject: [Haskell-beginners] Re: Gtk2Hs and Cairo on Windows
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> tutorial
> http://darcs.haskell.org/gtk2hs/docs/tutorial/Tutorial_Port/app1.xhtml.
> On linux; no problem.
> But for some reason I get a "not in scope: `eventSent`" error on Windows
> and I can't compile.
This tutorial is not updated to the last version of gtk2hs, or,
better, it doesn't use the new names for widget events and
doesn't handle then using EventM. ('onExpose', for instance, is
deprecated in current gtk2hs.)
I guess you installed the latest version in Windows, and
that's why you have an error, since eventSent is something
different in version 0.10. Your linux install is probably
not the latest gtk2hs.
> How can I solve the problem and, more importantly, is it possible to
> write portable code with Gtk2Hs/Cairo ?
Develop your applications in the latest version for all
platforms. Try to install gtk2hs as user if you want, by
downloading gtk2hs source code and using:
./configure --prefix=/home/mauricio --with-user-pkgconf
I never had problems running the same application in linux and
windows, but I can't say there's no specific functionality where
problems can arrive. Cairo never gave me any problem.
Best,
MaurĂcio
------------------------------
Message: 8
Date: Sun, 28 Jun 2009 11:29:10 -0400
From: Joe Fredette <[email protected]>
Subject: [Haskell-beginners] Re: [Haskell-cafe] What is an "expected
type" ...
To: michael rice <[email protected]>
Cc: [email protected], Haskell Cafe mailing list
<[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
When Haskell runs it's type checker, it tries to "guess" the type of
each function. Thats why you can write:
map (+1)
and it knows that you're talking about a function of type:
Num a => [a] -> [a]
Another thing, called 'defaulting' resolves this, but you didn't ask
about that, so I won't go into it.
An expected type is one that you provide to the compiler in the form of
a type signature, this can be used to specialize a general type (like
the one I showed) or
to resolve ambiguous types the compiler can't, or just for
documentation/good practice. So when I write:
foo :: Num a => [a] -> [a]
foo ls = map (+1) ls
The "expected type" for `foo` is `Num a => [a] -> [a]`. I imagine you're
asking this because you got an error which said your expected type
doesn't match your inferred type. That might, for instance, happen if I
wrote:
bar :: String
bar = 'a'
'a' has type `Char`, since `String` is not `Char`, the type checker
infers that 'a' has type char, but _expects_ it to be type String. Two
solutions are as follows:
--- Method 1
bar :: Char
bar = 'a'
--- Method 2
bar :: String
bar = "a"
Can you see why those two changes fix the problem?
Also, just as a matter of process, I forwarded this to the
haskell-beginners list, as I imagine type errors like these come up a
lot, and someone probably has a better explanation over there.
/Joe
michael rice wrote:
> as opposed to an "inferred type"?
>
> Michael
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Haskell-Cafe mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jfredett.vcf
Type: text/x-vcard
Size: 296 bytes
Desc: not available
Url :
http://www.haskell.org/pipermail/beginners/attachments/20090628/b0eeda45/jfredett.vcf
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 12, Issue 14
*****************************************