Skip to content

Can't find interface-file declaration for variable getSolo

With a file:

{-# LANGUAGE PatternSynonyms #-}
module Main (main) where

import GHC.Tuple

type OneTuple = Solo

only :: OneTuple a -> a
only = getSolo

pattern OneTuple :: a -> Solo a
pattern OneTuple a = Solo a

main :: IO ()
main = print (only (OneTuple 'x'))

the current 9.2 tip and master fails with

Issue.hs:9:8: error:
    • Can't find interface-file declaration for variable getSolo
        Probable cause: bug in .hi-boot file, or inconsistent .hi file
        Use -ddump-if-trace to get an idea of which file caused the error
    • In the expression: getSolo
      In an equation for ‘only’: only = getSolo

This looks like a release blocker for 9.2


EDIT:

I think that having getSolo as a selector isn't as easy. Something to change in GHC.Builtin.Types? fst and snd aren't selectors of (,), though they could be, in pseudo-Haskell:

data (,) a b = (,)
    { fst :: a
    , snd :: b
    }

An easy fix, I suppose, is to demote getSolo to an ordinary function.

Edited by Oleg Grenrus
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information