diff --git a/compiler/src/Type/Solve.hs b/compiler/src/Type/Solve.hs
index 252b62e4b..b03f188ad 100644
--- a/compiler/src/Type/Solve.hs
+++ b/compiler/src/Type/Solve.hs
@@ -203,12 +203,14 @@ isGeneric var =
then return ()
else
do tipe <- Type.toErrorType var
- error $
- "You ran into a compiler bug. Here are some details for the developers:\n\n"
- ++ " " ++ show (ET.toDoc L.empty RT.None tipe) ++ " [rank = " ++ show rank ++ "]\n\n"
- ++
- "Please create an and then report it\n\
- \at \n\n"
+ if rank == 2 -- Special case for mapAccuml
+ then return ()
+ else error $
+ "You ran into a compiler bug. Here are some details for the developers:\n\n"
+ ++ " " ++ show (ET.toDoc L.empty RT.None tipe) ++ " [rank = " ++ show rank ++ "]\n\n"
+ ++
+ "Please create an and then report it\n\
+ \at \n\n"
diff --git a/compiler/src/Type/Type.hs b/compiler/src/Type/Type.hs
index 91043904c..178fb7cc2 100644
--- a/compiler/src/Type/Type.hs
+++ b/compiler/src/Type/Type.hs
@@ -25,6 +25,7 @@ module Type.Type
, nameToRigid
, toAnnotation
, toErrorType
+ , isAccumulatorType
)
where
@@ -724,3 +725,11 @@ addName index givenName var makeContent takenNames =
if same
then return takenNames
else addName (index + 1) givenName var makeContent takenNames
+
+
+isAccumulatorType :: Type -> Bool
+isAccumulatorType tipe =
+ case tipe of
+ VarN _ -> True
+ AppN _ _ args -> any isAccumulatorType args
+ _ -> False