Skip to content

Create typesafe method of obtaining dictionary types from class definitions, and constraint objects from dictionary types

Say I have a class like the following:

class IntLike a where
    fromInt :: Int -> a
    toInt :: a -> Int

There should be a typesafe, principled way to get the dictionary type created from buildClass in compiler/iface/BuildTyCl.lhs like such (in this hypothetical, using a type family:

plusN :: (IntLike a) => Int -> Dictionary (IntLike a)

It would be nice if the type family was injective, if it was implemented in such a way.

Trac metadata
Trac field Value
Version
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information