summaryrefslogtreecommitdiff
path: root/source/Checking/Exact/Datatype.hs
diff options
context:
space:
mode:
Diffstat (limited to 'source/Checking/Exact/Datatype.hs')
-rw-r--r--source/Checking/Exact/Datatype.hs13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/Checking/Exact/Datatype.hs b/source/Checking/Exact/Datatype.hs
index 8e0b907..01cde88 100644
--- a/source/Checking/Exact/Datatype.hs
+++ b/source/Checking/Exact/Datatype.hs
@@ -245,6 +245,17 @@ type Prepare failure =
type SourceOccurrence = (Location, Raw.Marker, CanonicalLexicalEntry)
+exactDatatypeInvalid
+ :: Location
+ -> Datatype.DatatypeValidationError
+ -> ExactDatatypeError
+exactDatatypeInvalid declarationLocation failure =
+ ExactDatatypeInvalid
+ (fromMaybe
+ declarationLocation
+ (Datatype.datatypeValidationErrorLocation failure))
+ (Datatype.renderDatatypeValidationError failure)
+
prepareExactDatatype
:: Raw.Block
-> [SourceOccurrence]
@@ -276,7 +287,7 @@ prepareExactDatatype block occurrences =
Except.lift
(Datatype.prepareCheckedDatatype pure internal)
>>= Except.liftEither
- . first (ExactDatatypeInvalid location)
+ . first (exactDatatypeInvalid location)
let symbols =
Datatype.checkedDatatypeHeadSymbol checked
:| toList