Check that types of non-erased instance arguments are type classes
jespercockx opened this issue · comments
Jesper Cockx commented
Currently we do not check that the type of an instance argument is actually compiled to a Haskell Constraint
, causing agda2hs
to generate ill-formed Haskell code. Here's an example:
open import Haskell.Prelude
instance
favoriteNumber : Int
favoriteNumber = 42
{-# INLINE favoriteNumber #-}
test : {{Int}} → Int
test {{x}} = x
{-# COMPILE AGDA2HS test #-}
Currently agda2hs
happily compiles this to the following nonsense:
test :: Int => Int
test = x
We should either disallow this, or else detect that the type has kind *
and compile it to a regular (explicit) argument in Haskell.
Jesper Cockx commented