Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/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. It needs a binder? (Alexander Chen)
2. Re: It needs a binder? (Dániel Arató)
----------------------------------------------------------------------
Message: 1
Date: Tue, 28 Apr 2020 21:21:16 +0200 (CEST)
From: Alexander Chen <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] It needs a binder?
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"
Hi,
binder.hs
i:: Num a => a
prelude>:l binder.hs
typed_checked.hs:1:1: error:
The type signature for ‘i’ lacks an accompanying binding
|
1 | i:: Num a=> a | ^
binder.hs
i:: Num a => a
i = 2
prelude>:l binder.hs
[1 of 1] Compiling Main
Ok, one module loaded.
Why does it need a binder to make it work?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20200428/b74ba1de/attachment-0001.html>
------------------------------
Message: 2
Date: Wed, 29 Apr 2020 10:46:13 +0200
From: Dániel Arató <[email protected]>
To: Alexander Chen <[email protected]>, The Haskell-Beginners
Mailing List - Discussion of primarily beginner-level topics related
to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] It needs a binder?
Message-ID:
<cahvkd2+qk3yo_papekgjoto+jvldwhfbpfeexbzucfqugzm...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Using classic C/C++/Java terms what you're doing in the first version is
analogous to _declaring_ a function but not _defining_ it, e.g.
// binding_incorrect.c
int i();
// No definition leads to an error
// binding_correct.c
int i() {
return 0;
}
The error message says that you have declared the type of i to be Num a =>
a, but no corresponding definition was found. That's the reason your second
version compiles fine
On Tue, 28 Apr 2020 at 21:22, Alexander Chen <[email protected]> wrote:
> Hi,
>
> binder.hs
>
> i:: Num a => a
>
> *prelude>*:l binder.hs
> typed_checked.hs:1:1: error:
> The type signature for ‘i’ lacks an accompanying binding
> |
> 1 | i:: Num a=> a | ^
>
>
> binder.hs
>
> i:: Num a => a
> i = 2
>
> *prelude>*:l binder.hs
> [1 of 1] Compiling Main
> Ok, one module loaded.
>
>
> Why does it need a binder to make it work?
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20200429/e788d571/attachment-0001.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 142, Issue 7
*****************************************