haskell-jp / random #102 at 2023-03-12 11:20:12 +0900

なんか変なGHCのバグ踏んで面白かったので報告します.多分 https://gitlab.haskell.org/ghc/ghc/-/issues/12091 関係なんですけど,このissueってresolvedでcloseされてるんですよね:

$ mkdir ghcbugtest
$ cd ghcbugtest
$ echo "main = return () :: IO ()" > Test.hs
$ ghci-9.2.7 -fobject-code Test.hs
GHCi, version 9.2.7:   :? for help
[1 of 1] Compiling Main             ( Test.hs, Test.o )
Ok, one module loaded.
ghci> :{
ghci| f :: a -> a
ghci| f = id
ghci| :}
ghci> f

<interactive>:5:1: error: Variable not in scope: f
ghci> f :: a -> a; f = id
ghci> f

<interactive>:2:1: error: Variable not in scope: f
ghci> f = id :: a -> a
ghci> f

<interactive>:2:1: error:
    • No instance for (Show (a0 -> a0)) 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
とりあえず報告してきました: https://gitlab.haskell.org/ghc/ghc/-/issues/23107