ffilozov 2017-02-22 16:14:36
When I do 1.0 :: Integer at the REPL, it tells me that there's "No instance of (Fractional Integer)..". How would implementing Fractional for Integer fix this problem?
Welkin 2017-02-22 16:14:55
integers cannot be fractional
Welkin 2017-02-22 16:15:01
that's the definition
Welkin 2017-02-22 16:15:26
> 1.0 :: Float
lambdabot 2017-02-22 16:15:30
1.0
Welkin 2017-02-22 16:15:33
> 1.0 :: Integer
lambdabot 2017-02-22 16:15:36
error:
lambdabot 2017-02-22 16:15:36
• No instance for (Fractional Integer)
lambdabot 2017-02-22 16:15:36
arising from the literal '1.0'
Welkin 2017-02-22 16:15:40
> 1 :: Integer
lambdabot 2017-02-22 16:15:43
1
dmwit 2017-02-22 16:18:16
ffilozov: `1.0` is syntactic sugar for `fromRational (10%10)`.
dmwit 2017-02-22 16:18:35
ffilozov: So implementing `Fractional` would solve the problem by providing an implementation of `fromRational` that returned an `Integer`.
ffilozov 2017-02-22 16:18:56
Right, so :t 1.0 -> Fractional a => a. So that makes sense that I get that error.
dmwit 2017-02-22 16:19:23
ffilozov: However, see also the NumDecimals extension, which lets you write `1.0 :: Integer` but not `1.5 :: Integer`.
dmwit 2017-02-22 16:20:31
...now I kind of want to push a HexaDecimals extension as an April Fools' joke or something. =P
ffilozov 2017-02-22 16:20:41
Thanks.
qmm 2017-02-22 16:25:32
how can you represent List: Set -> Mon which is a functor taking each set S to the monoid of lists with elements drawn from S?
qmm 2017-02-22 16:28:27
...in haskell
Welkin 2017-02-22 16:28:47
is that like saying "on the internet"?
qmm 2017-02-22 16:28:57
perhaps
qmm 2017-02-22 16:29:56
i've felt for the longest time that haskell's type system gives us facilities to work with and describe universal truths from category theory
qmm 2017-02-22 16:30:13
i haven't worked up to that point yet, but i'm trying :)
qmm 2017-02-22 16:32:40
:info Functor