Add support for associated type families
jespercockx opened this issue · comments
It would be useful and relatively easy to add support for associated types to type classes. Here's an example:
open import Haskell.Prelude
record Collection (c : Set) : Set₁ where
field
Elem : Set
empty : c
insert : Elem → c → c
member : Elem → c → Bool
toList : c → List Elem
open Collection {{...}} public
{-# COMPILE AGDA2HS Collection class #-}
instance
iCollectionList : {{Eq a}} → Collection (List a)
iCollectionList {a} = record
{ Elem = a
; empty = []
; insert = _∷_
; member = elem
; toList = id
}
{-# COMPILE AGDA2HS iCollectionList #-}
Currently this produces a panic in agda2hs
:
Panic: Pattern match failure in 'do' block at
src/Agda2Hs/Compile/Term.hs:147:7-26
To think about: how to support the case when Elem
is an associated data type?