Skip to content

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

@cartazio

Description

@cartazio

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions