achirkin / easytensor

Many-dimensional type-safe numeric ops
https://hackage.haskell.org/package/easytensor
BSD 3-Clause "New" or "Revised" License
46 stars 2 forks source link

Need a better error message for absence PrimBytes (DataFrame t ds) instance #9

Closed achirkin closed 5 years ago

achirkin commented 6 years ago

When a code requires PrimBytes (DataFrame t ds), GHC uses a deriving instance PrimBytes (Array t ds) => PrimBytes (DataFrame t ds), which, in turn, requires PrimBytes (Array t ds). Array t ds is a type family; only individual members of the type family have the instance. To make things worse, there are other instances of PrimBytes defined in easytensor-vulkan. And GHC starts to panic (Overlapping instances for PrimBytes).

Need to try to reconsider a combination of TypeError and OverlappingInstances to improve this.

The issue comes from a comment https://github.com/achirkin/easytensor/issues/4#issuecomment-410538952.

achirkin commented 5 years ago

Since version 2 of easytensor, there is at most one incoherent instance of every class - the one that depends on KnownBackend. That solves the issue.