Skip to content

Instantly share code, notes, and snippets.

@guibou
Created September 12, 2019 22:26
Show Gist options
  • Select an option

  • Save guibou/a094245b9d465eba67dd7785f0dec76a to your computer and use it in GitHub Desktop.

Select an option

Save guibou/a094245b9d465eba67dd7785f0dec76a to your computer and use it in GitHub Desktop.
Haskell build with unresolved type family
TortueLama12.hs:14:1: warning: [-Wmissing-signatures]
    Top-level binding with no type signature:
      v :: Foo (Bar Float Float)
   |
14 | v = (Foo @Float) `frob` (Foo @Float)

Bar Float Float does not exists, and yet it typecheck.

More, if I add Bar _ _ = TypeError (Text "nice message") in the type family, it fails as expected.

{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeApplications #-}
data Foo k = Foo
type family Bar a b where
Bar Int Int = Int
frob :: Foo k -> Foo k' -> Foo (Bar k k')
frob Foo Foo = Foo
v = (Foo @Float) `frob` (Foo @Float)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment