shithub: MicroHs

Download patch

ref: af3fc6e91ab6cfd87e58dc832f006364d7d24633
parent: 31c67fdfb9c30df33915df9f98d524491db02f29
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Fri Oct 6 06:45:25 EDT 2023

Add isTupleConstr

--- a/src/MicroHs/Expr.hs
+++ b/src/MicroHs/Expr.hs
@@ -23,7 +23,7 @@
   Constr,
   ConTyInfo,
   Con(..), conIdent, conArity, eqCon,
-  tupleConstr, untupleConstr,
+  tupleConstr, untupleConstr, isTupleConstr,
   subst,
   allVarsExpr, allVarsBind,
   getSLocExpr, setSLocExpr,
@@ -208,6 +208,9 @@
 
 untupleConstr :: Ident -> Int
 untupleConstr i = length (unIdent i) + 1
+
+isTupleConstr :: Int -> Ident -> Bool
+isTupleConstr n i = eqChar (head (unIdent i)) ',' && untupleConstr i == n
 
 ---------------------------------
 
--