replicating my remark elsewhere
is we could have roughly do the following (which does admittedly get sort of
exisential, singleton, hasochismy, but coverage checking is )
{-# LANGUAGE DataKinds,TypeFamilies,GADTs #-}
module StubName where
data ErrorUniverse = EvalError | NormalizerError
| HeapError | ParserError | UnificationError
| TypeError | ReportABugToDevelopersPlease --- etc
-- Error info Singleton Gadt
data ErrorSng (a :: ErrorUniverse ) where
SEvalError :: ErrorSng 'EvalError
SNormalizerEror :: ErrorSng 'NormalizerError
SHeapError :: ErrorSng 'HeapError
SParserError :: ErrorSng 'ParserError
--- ....
data Family ErrorInfo (a :: ErrorUniverse ) :: *
data SomeHopperError where
SomeHE :: forall a . (Show (ErrorInfo a), Typeable (ErrorInfo a))
=> ErrorSing a -> ErrorInfo a -> SomeHopperError
the data family/show/typeable instances would have to be defined in the applicable sub systems, but at any given time ... we kinda know what the universe of errors are, and being able to just use case / coverage checking in handler code might be nice
To be clear, I dont think we should do this now, but while we're hear, figured i should mention it :)
replicating my remark elsewhere
is we could have roughly do the following (which does admittedly get sort of
exisential, singleton, hasochismy, but coverage checking is )
{-# LANGUAGE DataKinds,TypeFamilies,GADTs #-} module StubName where data ErrorUniverse = EvalError | NormalizerError | HeapError | ParserError | UnificationError | TypeError | ReportABugToDevelopersPlease --- etc -- Error info Singleton Gadt data ErrorSng (a :: ErrorUniverse ) where SEvalError :: ErrorSng 'EvalError SNormalizerEror :: ErrorSng 'NormalizerError SHeapError :: ErrorSng 'HeapError SParserError :: ErrorSng 'ParserError --- .... data Family ErrorInfo (a :: ErrorUniverse ) :: * data SomeHopperError where SomeHE :: forall a . (Show (ErrorInfo a), Typeable (ErrorInfo a)) => ErrorSing a -> ErrorInfo a -> SomeHopperErrorthe data family/show/typeable instances would have to be defined in the applicable sub systems, but at any given time ... we kinda know what the universe of errors are, and being able to just use case / coverage checking in handler code might be nice
To be clear, I dont think we should do this now, but while we're hear, figured i should mention it :)