Skip to content

Private typeclasses don't compile correctly #562

@natefaubion

Description

@natefaubion
module Foo (Boop(..), blub) where
  class Blub a where
    blub :: a -> a

  data Boop = Boop

  instance showBoop :: Show Boop where
    show x = "Boop"

  instance blupBoop :: Blub Boop where
    blub x = x

module Main where
  import Foo (Boop(..), blub)
  import Debug.Trace

  main = trace $ show (blub Boop)
 psc privatetc.purs --module=Main | node
[stdin]:66
ain = Debug_Trace.trace(Prelude.show(Foo.showBoop({}))(Foo.blub(Foo.blupBoop({
                                                                    ^
TypeError: Object #<Object> has no method 'blupBoop'

I exported the methods of the class, but not the class itself, which means the instances don't get exporting resulting in a runtime error. This worked in 0.5.3, though externs were buggy. In 0.5.3 it would extern signatures that mentioned the class, but not the class itself, resulting in "Unknown type class" errors in psci.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions