Added a ShowOccam instance for A.Dimension

This commit is contained in:
Neil Brown 2009-02-02 23:51:15 +00:00
parent bf365ee41a
commit ec1341849d

View File

@ -219,6 +219,10 @@ instance ShowOccam A.Name where
instance ShowRain A.Name where instance ShowRain A.Name where
showRainM n = showName n 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 instance ShowOccam A.Type where
showOccamM A.Bool = tell ["BOOL"] showOccamM A.Bool = tell ["BOOL"]
showOccamM A.Byte = tell ["BYTE"] showOccamM A.Byte = tell ["BYTE"]
@ -244,12 +248,7 @@ instance ShowOccam A.Type where
= tell ["(inferred numeric type: ",show m," ",show n,")"] = tell ["(inferred numeric type: ",show m," ",show n,")"]
showOccamM (A.Mobile t) = tell ["MOBILE "] >> showOccamM t showOccamM (A.Mobile t) = tell ["MOBILE "] >> showOccamM t
showOccamM (A.Array ds t) showOccamM (A.Array ds t)
= (sequence dims) >> showOccamM t = mapM showOccamM ds >> showOccamM t
where
dims = [case d of
A.Dimension n -> tell ["["] >> showOccamM n >> tell ["]"]
A.UnknownDimension -> tell ["[]"]
| d <- ds]
showOccamM (A.ChanEnd dir ca t) showOccamM (A.ChanEnd dir ca t)
= tell [shared, "CHAN", direction, " "] >> showOccamM t = tell [shared, "CHAN", direction, " "] >> showOccamM t
where where