Skip to content

Instantly share code, notes, and snippets.

@ammaraskar
Created February 16, 2018 07:17
Show Gist options
  • Save ammaraskar/f2de65f3f2cb0c003b5a36f4018375e9 to your computer and use it in GitHub Desktop.
Save ammaraskar/f2de65f3f2cb0c003b5a36f4018375e9 to your computer and use it in GitHub Desktop.
Demonstration of Haskell's type defaulting converting Num -> Integer
λ ghci -Wtype-defaults
GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help
Prelude> :t 23
23 :: Num p => p
Prelude> quot 23 2
<interactive>:2:1: warning: [-Wtype-defaults]
* Defaulting the following constraints to type `Integer'
(Show a0) arising from a use of `print' at <interactive>:2:1-9
(Integral a0) arising from a use of `it' at <interactive>:2:1-9
* In a stmt of an interactive GHCi command: print it
11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment