augustss / MicroHs

Haskell implemented with combinators
Other
367 stars 25 forks source link

Qualified import provokes failure to find default implementation #52

Closed ysangkok closed 4 months ago

ysangkok commented 4 months ago

This program fails to compile with MicroHs e3161204db4fbc9032cbdbeab83529db2a095ad4, but succeeds with GHC 9.10.1:

module Minimal where

import Data.Foldable (Foldable(foldMap))

newtype ID a = MkID a

instance Foldable ID where
  foldMap :: Monoid m => (a -> m) -> ID a -> m
  foldMap f (MkID a) = f a

main :: IO ()
main = pure ()

The failure is

mhs: "./Minimal.hs": line 7, col 10: undefined value: fold$dflt

I didn't refer to fold, so I shouldn't need to import it.

If I change the import to be open (import Data.Foldable), it compiles.

augustss commented 4 months ago

Thanks for the report. Fixed in 87a312e59ca8cee7e74190522528da0130b818e6