From ec1341849de909263060f410a89ac0e74f5eb29b Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Mon, 2 Feb 2009 23:51:15 +0000 Subject: [PATCH] Added a ShowOccam instance for A.Dimension --- common/ShowCode.hs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/common/ShowCode.hs b/common/ShowCode.hs index 3b754ce..3c5032b 100644 --- a/common/ShowCode.hs +++ b/common/ShowCode.hs @@ -219,6 +219,10 @@ instance ShowOccam A.Name where instance ShowRain A.Name where showRainM n = showName n +instance ShowOccam A.Dimension where + showOccamM (A.Dimension n) = tell ["["] >> showOccamM n >> tell ["]"] + showOccamM A.UnknownDimension = tell ["[]"] + instance ShowOccam A.Type where showOccamM A.Bool = tell ["BOOL"] showOccamM A.Byte = tell ["BYTE"] @@ -244,12 +248,7 @@ instance ShowOccam A.Type where = tell ["(inferred numeric type: ",show m," ",show n,")"] showOccamM (A.Mobile t) = tell ["MOBILE "] >> showOccamM t showOccamM (A.Array ds t) - = (sequence dims) >> showOccamM t - where - dims = [case d of - A.Dimension n -> tell ["["] >> showOccamM n >> tell ["]"] - A.UnknownDimension -> tell ["[]"] - | d <- ds] + = mapM showOccamM ds >> showOccamM t showOccamM (A.ChanEnd dir ca t) = tell [shared, "CHAN", direction, " "] >> showOccamM t where