[Haskell-cafe] Using deriving with indexed data types

Tom Ellis tom-lists-haskell-cafe-2023 at jaguarpaw.co.uk
Sat Sep 30 16:37:45 UTC 2023


How are Haskell folks using indexed types (indexed by types of
DataKinds) whilst still being able to take advantage of GHC's
deriving?  I wrote up my approach into a small library:

https://github.com/tomjaguarpaw/ad/blob/589926448865700fa616e8c6f6e4a011384499cb/indexed-types/src/IndexedTypes/Index.hs

Here's an example of using my approach:

https://github.com/tomjaguarpaw/ad/blob/master/indexed-types/src/IndexedTypes/Example.hs

and it shows you can still use deriving for all your instances:

https://github.com/tomjaguarpaw/ad/blob/master/indexed-types/src/IndexedTypes/Example.hs

I'd be interested to know what other approaches people are using in
practice. Thanks,

Tom


More information about the Haskell-Cafe mailing list