From 1baecd795563cf73d9a2316edce7c039dbe95606 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Tue, 18 Sep 2007 09:50:45 +0000 Subject: [PATCH] Moved findMeta into the Metadata module --- common/Metadata.hs | 8 ++++++++ common/Types.hs | 10 ---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/common/Metadata.hs b/common/Metadata.hs index b89b472..3ef3c6b 100644 --- a/common/Metadata.hs +++ b/common/Metadata.hs @@ -75,3 +75,11 @@ unpackMeta ('~':s) = (m, rest) metaColumn = read cs } unpackMeta s = (emptyMeta, s) + +-- | Find the first Meta value in some part of the AST. +findMeta :: (Data t, Typeable t) => t -> Meta +findMeta e = if null metaList then emptyMeta else head metaList + where + metaList = gmapQ (mkQ emptyMeta findMeta') e + findMeta' :: Meta -> Meta + findMeta' m = m diff --git a/common/Types.hs b/common/Types.hs index bc37c9c..12ef9cf 100644 --- a/common/Types.hs +++ b/common/Types.hs @@ -30,8 +30,6 @@ module Types , leastGeneralSharedTypeRain - , findMeta - ) where import Control.Monad @@ -325,14 +323,6 @@ makeAbbrevAM am = am makeConstant :: Meta -> Int -> A.Expression makeConstant m n = A.Literal m A.Int $ A.IntLiteral m (show n) --- | Find the first Meta value in some part of the AST. -findMeta :: (Data t, Typeable t) => t -> Meta -findMeta e = if null metaList then emptyMeta else head metaList - where - metaList = gmapQ (mkQ emptyMeta findMeta') e - findMeta' :: Meta -> Meta - findMeta' m = m - -- | Checks whether a given conversion can be done implicitly in Rain -- Parameters are src dest isImplicitConversionRain :: A.Type -> A.Type -> Bool