Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Incorrect behaviour when resolving associated type of an interface  #4918

@casper-pragma

Description

@casper-pragma

I have defined the following interface:

interface Failable c where
  Failure : Type
  initWithFailure : Failure -> c

Then I proceeded to create an implementation:

Failable (Maybe a) where
  Failure = ({T:Type} -> T)
  initWithFailure _ = Nothing

This was accepted by the compiler, but when I tried to use it in the following manner...

main :: IO ()
main = do
  let smth : ({K:Type} -> Maybe K) = initWithFailure ()

...the compiler said that there is a type mismatch between () and Failure.

This not suppose to happen, right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions