Skip to content

Commit

Permalink
give proper name of builtins
Browse files Browse the repository at this point in the history
  • Loading branch information
janmasrovira committed Nov 20, 2024
1 parent d0dc415 commit 267b34a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ instance ToGenericError BuiltinErrorMessage where
data DerivingTypeWrongForm = DerivingTypeWrongForm
{ _derivingTypeWrongForm :: I.Expression,
_derivingTypeBuiltin :: I.DerivingTrait,
_derivingTypeSupportedBuiltins :: [I.DerivingTrait]
_derivingTypeSupportedBuiltins :: [I.Name]
}

instance ToGenericError DerivingTypeWrongForm where
Expand Down
6 changes: 5 additions & 1 deletion src/Juvix/Compiler/Internal/Translation/FromConcrete.hs
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,12 @@ getDefinedInductive ind = do

throwDerivingWrongForm :: (Members '[Error ScoperError, Reader S.InfoTable] r) => Internal.Expression -> Sem r a
throwDerivingWrongForm ret = do
let getSym :: (BuiltinPrim, S.Symbol) -> Maybe Internal.Name
getSym (p, s) = do
guard (isJust (Internal.derivingTraitFromBuiltin p))
return (goSymbol s)
_derivingTypeSupportedBuiltins <-
mapMaybe Internal.derivingTraitFromBuiltin . HashMap.keys
mapMaybe getSym . HashMap.toList
<$> asks (^. S.infoBuiltins)
throw $
ErrDerivingTypeWrongForm
Expand Down

0 comments on commit 267b34a

Please sign in to comment.