Stil not clear how this works:
Output:
-4
…or this:
Output:
0.1411200080598672
Despite, lentgthy discussions here: https://www.reddit.com/r/haskell/comments/1r3w3w/implicit_type_conversion_for_value_constants/
And despite this: https://www.haskell.org/onlinereport/decls.html#sect4.3.4
And despite this: https://kseo.github.io/posts/2017-01-04-type-defaulting-in-haskell.html
…which states: “Haskell default rule can be summarized as:”
Latest reserach in GHC.Num shows:
Even more puzzling, this here does not compile:
Compiler error:
app\Main.hs:7:5: error:
* Ambiguous type variable `a0' arising from a use of `print'
prevents the constraint `(Show a0)' from being solved.
Probable fix: use a type annotation to specify what `a0' should be.
These potential instances exist:
instance Show Ordering -- Defined in `GHC.Show'
instance Show Integer -- Defined in `GHC.Show'
instance Show a => Show (Maybe a) -- Defined in `GHC.Show'
...plus 22 others
...plus 28 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
* In a stmt of a 'do' block: print $ sin 3
In the expression: do print $ sin 3
In an equation for `main': main = do print $ sin 3
|
7 | print $ sin 3
| ^^^^^^^^^^^^^
It will work again, like this:
Output:
0.14112