diff --git a/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping/Error/Types.hs b/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping/Error/Types.hs index e2be00c44b..fcf0b17bf4 100644 --- a/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping/Error/Types.hs +++ b/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping/Error/Types.hs @@ -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 diff --git a/src/Juvix/Compiler/Internal/Translation/FromConcrete.hs b/src/Juvix/Compiler/Internal/Translation/FromConcrete.hs index b7e4638c72..0f467ecbb5 100644 --- a/src/Juvix/Compiler/Internal/Translation/FromConcrete.hs +++ b/src/Juvix/Compiler/Internal/Translation/FromConcrete.hs @@ -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