You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ghci> data T = MkT
ghci> MkT
<interactive>:2:1: error:
• No instance for (Show T) arising from a use of ‘print’
• In a stmt of an interactive GHCi command: print it
ghci> 0#
<interactive>:3:1: error:
• Couldn't match a lifted type with an unlifted type
When matching types
a0 :: *
GHC.Prim.Int# :: TYPE 'GHC.Types.IntRep
• In the first argument of ‘print’, namely ‘it’
In a stmt of an interactive GHCi command: print it
The part stmt of an interactive GHCi command: print it is confusing.
It corresponds to what's happening under the hood - it will change if you set -fno-it and/or -interactive-print <fun>, but I still think it's not good enough. This error is often seen by beginners.
The text was updated successfully, but these errors were encountered:
Similarly, printing functions in GHCI also creates confusing error messages:
Reproduction
λ> add x y = x + y
add::Numa=>a->a->a
λ> add
<interactive>:8:1:error:•No instance for (Show (Integer->Integer->Integer))
arising from a use of‘print’
(maybe you haven't applied a function to enough arguments?)
•In a stmt of an interactive GHCi command:print it
Suggestion
suggest the programmer to import Text.Show.Functions:
λ> add x y = x + y
add::Numa=>a->a->a
λ> add
<interactive>:8:1:error:•No instance for (Show (Integer->Integer->Integer))
arising from a use of‘print’
(maybe you haven't applied a function to enough arguments?)
•In a stmt of an interactive GHCi command:print it
•Maybe you want to interactively print a typeof function inGHCi?if so, type 'import Text.Show.Functions', to be able to:
λ> add
<function>it::Numa=>a->a->a
The part
stmt of an interactive GHCi command: print it
is confusing.It corresponds to what's happening under the hood - it will change if you set
-fno-it
and/or-interactive-print <fun>
, but I still think it's not good enough. This error is often seen by beginners.The text was updated successfully, but these errors were encountered: