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. Using Fractional Type (A. Mc.)
2. Re: Using Fractional Type (Bob Ippolito)
3. Re: Using Fractional Type (David James)
----------------------------------------------------------------------
Message: 1
Date: Sat, 20 Feb 2021 11:59:07 -0800
From: "A. Mc." <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Using Fractional Type
Message-ID:
<caosti3kknasrmt-rqpfwh_gvpaqp4a_6f1_vxel_urzkelc...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hello,
I need to create a function that does: mod (recip x) y. However, I am
getting all kinds of errors with the type signature. Is there a better way
to use Fractional type than needing to enable FlexibleContexts? What do I
need to do to still make use of Haskell's type system, but also still be
able to perform operations such as reciprocal (and division into fractions
for that matter).
Thanks in advance and thank you for your time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20210220/8962d2de/attachment-0001.html>
------------------------------
Message: 2
Date: Sat, 20 Feb 2021 15:11:18 -0800
From: Bob Ippolito <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Using Fractional Type
Message-ID:
<cacwmpm_np_qjda-cwnokkvqwkb9ohvgdnwz_jly+8dojxp1...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
I think what you're looking for is the mod' function from Data.Fixed. The
mod function only works with Integral types, FlexibleContexts wouldn't be
helpful for this.
On Sat, Feb 20, 2021 at 12:00 PM A. Mc. <[email protected]> wrote:
> Hello,
>
> I need to create a function that does: mod (recip x) y. However, I am
> getting all kinds of errors with the type signature. Is there a better way
> to use Fractional type than needing to enable FlexibleContexts? What do I
> need to do to still make use of Haskell's type system, but also still be
> able to perform operations such as reciprocal (and division into fractions
> for that matter).
>
> Thanks in advance and thank you for your time.
> _______________________________________________
> 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/20210220/6eb1a6f0/attachment-0001.html>
------------------------------
Message: 3
Date: Sun, 21 Feb 2021 08:41:52 +0000
From: David James <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Using Fractional Type
Message-ID:
<am6pr04mb42143235ac57ba9a34801cf5b6...@am6pr04mb4214.eurprd04.prod.outlook.com>
Content-Type: text/plain; charset="windows-1252"
Also, I wonder if you’re typing:
> 5 mod 2
This does give a FlexibleContexts error. You should type either:
> mod 5 2
or
> 5 `mod` 2
(or, using mod’ as suggested):
> 5.5 `mod'` 1.3
You can read about prefix and infix notation
here<http://learnyouahaskell.com/starting-out>.
David.
From: Bob Ippolito<mailto:[email protected]>
Sent: 20 February 2021 23:11
To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level
topics related to Haskell<mailto:[email protected]>
Subject: Re: [Haskell-beginners] Using Fractional Type
I think what you're looking for is the mod' function from Data.Fixed. The mod
function only works with Integral types, FlexibleContexts wouldn't be helpful
for this.
On Sat, Feb 20, 2021 at 12:00 PM A. Mc.
<[email protected]<mailto:[email protected]>> wrote:
Hello,
I need to create a function that does: mod (recip x) y. However, I am getting
all kinds of errors with the type signature. Is there a better way to use
Fractional type than needing to enable FlexibleContexts? What do I need to do
to still make use of Haskell's type system, but also still be able to perform
operations such as reciprocal (and division into fractions for that matter).
Thanks in advance and thank you for your time.
_______________________________________________
Beginners mailing list
[email protected]<mailto:[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/20210221/9dc4c60d/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 151, Issue 11
******************************************