Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

closed but no-orphans but sane semi open-eque Hopper error datamodel #13

Open
cartazio opened this issue Apr 18, 2016 · 0 comments
Open

Comments

@cartazio
Copy link
Member

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant