]> git.unchartedbackwaters.co.uk Git - francis/ofc.git/commitdiff
Reformat ADT declarations.
authorFrancis Russell <francis@unchartedbackwaters.co.uk>
Wed, 5 Dec 2012 19:36:33 +0000 (19:36 +0000)
committerFrancis Russell <francis@unchartedbackwaters.co.uk>
Mon, 17 Dec 2012 00:19:49 +0000 (00:19 +0000)
OFC/Common.hs
OFC/SecondLevel.hs
OFC/TargetMapping.hs
OFC/TopLevel.hs

index aeb8e65156b05f608d61478d7c7842c11f528e37..e4d0684bab22f790e9e843fab9f5b6c8e55e84ed 100644 (file)
@@ -8,10 +8,10 @@ import Text.PrettyPrint
   , integer, int, parens)
 import Data.Complex (Complex(..), realPart, imagPart)
 
-data IndexType 
-  FunctionIndex | 
-  SpinIndex | 
-  SpatialIndex 
+data IndexType 
+  = FunctionIndex 
+  | SpinIndex 
+  SpatialIndex 
   deriving (Show, Eq, Enum, Bounded)
 
 class PrettyPrintable a where
index 3069e3e7d574cd9103081a0b7e25ae45bb9a6ca2..137e35c579132560c8b3d4dc01bcc6a8fe17384b 100644 (file)
@@ -30,26 +30,26 @@ maxPsincDensity = 2
 
 type SymbolTable = Map String SymbolType
 
-data Quantification 
-  Forall |
-  Bound
+data Quantification 
+  = Forall 
+  | Bound 
   deriving Show
 
-data SymbolType 
-  ValueTag ValueType [IndexType] | 
-  IndexTag IndexType Quantification
+data SymbolType 
+  = ValueTag ValueType [IndexType] 
+  IndexTag IndexType Quantification
   deriving Show
 
-data ValueType 
-  ScalarT ScalarType |
-  PositionT PositionFieldType |
-  MomentumT MomentumFieldType
+data ValueType 
+  = ScalarT ScalarType 
+  | PositionT PositionFieldType 
+  MomentumT MomentumFieldType
   deriving (Eq, Show)
 
-data ScalarType =
-  RealType | 
-  ComplexType |
-  IntegerType
+data ScalarType 
+  = RealType 
+  | ComplexType 
+  IntegerType
   deriving (Eq, Show)
 
 instance Monoid ScalarType where
@@ -60,14 +60,14 @@ instance Monoid ScalarType where
   mappend ComplexType _ = ComplexType
   mappend _ ComplexType = ComplexType
 
-data PositionFieldType =
-  Psinc Integer |
-  AnalyticPositionType
+data PositionFieldType 
+  = Psinc Integer 
+  | AnalyticPositionType 
   deriving (Eq, Show)
 
-data MomentumFieldType =
-  PsincReciprocal Integer |
-  AnalyticMomentumType
+data MomentumFieldType
+  = PsincReciprocal Integer 
+  AnalyticMomentumType
   deriving (Eq, Show)
 
 data PsincE
@@ -78,16 +78,16 @@ deriving instance Show PsincE
 deriving instance Show PsincReciprocalE
 deriving instance Show ScalarE
 
-data OperatorExpr num terminal =
-  OpAdd (OperatorExpr num terminal) (OperatorExpr num terminal) |
-  OpSub (OperatorExpr num terminal) (OperatorExpr num terminal) |
-  OpMul (OperatorExpr num terminal) (OperatorExpr num terminal) |
-  OpDiv (OperatorExpr num terminal) (OperatorExpr num terminal) |
-  OpPow (OperatorExpr num terminal) (OperatorExpr num terminal) |
-  OpNeg (OperatorExpr num terminal) |
-  OpIndexedScalarIdentifier String [String] |
-  OpConstant num |
-  OpTerminal terminal
+data OperatorExpr num terminal
+  = OpAdd (OperatorExpr num terminal) (OperatorExpr num terminal)
+  | OpSub (OperatorExpr num terminal) (OperatorExpr num terminal)
+  | OpMul (OperatorExpr num terminal) (OperatorExpr num terminal)
+  | OpDiv (OperatorExpr num terminal) (OperatorExpr num terminal)
+  | OpPow (OperatorExpr num terminal) (OperatorExpr num terminal)
+  | OpNeg (OperatorExpr num terminal)
+  | OpIndexedScalarIdentifier String [String]
+  | OpConstant num
+  OpTerminal terminal
   deriving Show
 
 instance (PrettyPrintable num, PrettyPrintable terminal) => PrettyPrintable (OperatorExpr num terminal) where
@@ -106,15 +106,15 @@ instance (PrettyPrintable num, PrettyPrintable terminal) => PrettyPrintable (Ope
     where
     binaryToDoc op lhs rhs = parens $ hcat [toDoc lhs, text op, toDoc rhs]
 
-data PositionTerminal =
-  PositionComponent String
+data PositionTerminal 
+  PositionComponent String
   deriving Show
 
 instance PrettyPrintable PositionTerminal where
   toDoc (PositionComponent index) = text $ "r[" ++ index ++ "]"
 
-data MomentumTerminal =
-  MomentumComponent String
+data MomentumTerminal 
+  MomentumComponent String
   deriving Show
 
 instance PrettyPrintable MomentumTerminal where
@@ -370,9 +370,9 @@ generateVariants ofl2 expr = case expr of
       Left _ -> []
       Right _ -> resampled ofl2 e
 
-data Assignment =
- AssignPsinc (Expression PsincE) (Expression PsincE) |
- AssignScalar (Expression ScalarE) (Expression ScalarE)
+data Assignment 
+  = AssignPsinc (Expression PsincE) (Expression PsincE) 
 | AssignScalar (Expression ScalarE) (Expression ScalarE)
  deriving Show 
 
 instance PrettyPrintable Assignment where
@@ -555,9 +555,9 @@ buildPositionOperator _ _ e = error $ "Unhandled expression: " ++ prettyPrint e
 
 -- Frequency fixup
 
-data Bandwidth =
-  GMaxMultiple Integer |
-  Infinite
+data Bandwidth 
+  = GMaxMultiple Integer 
+  Infinite
   deriving (Eq, Show)
 
 instance Ord Bandwidth where
index d8feb929bbea6fde2132d5a14b5f3b0e2a9694ff..907f72940b0c08a305b5c542d03057f5aa8c35d1 100644 (file)
@@ -17,48 +17,48 @@ import Data.Maybe (catMaybes)
 
 type MappingTable = Map String TargetType
 
-data TargetType 
-  FortranParameter [FortranParamProperty] |
-  PPDFunctionSet [PPDFunctionSetProperty]
+data TargetType 
+  = FortranParameter [FortranParamProperty] 
+  PPDFunctionSet [PPDFunctionSetProperty]
   deriving Show
 
-data FortranType 
-  Array FortranType [ArrayIndex] |
-  SPAM3 |
-  FunctionBasis |
-  Double |
-  Integer
+data FortranType 
+  = Array FortranType [ArrayIndex] 
+  | SPAM3 
+  | FunctionBasis 
+  | Double 
+  Integer
   deriving Show
 
-data ArrayIndex 
-  UnnamedIndex | 
-  NamedIndex String
+data ArrayIndex 
+  = UnnamedIndex 
+  NamedIndex String
   deriving Show
 
-data SpaceInfo =
-  CoarsePsinc [String] |
-  FinePsinc [String]
+data SpaceInfo 
+  = CoarsePsinc [String] 
+  FinePsinc [String]
   deriving Show
 
-data FortranParamProperty =
-  ParamName String |
-  ParamType FortranType |
-  Space SpaceInfo |
-  Indexed [String]
+data FortranParamProperty 
+  = ParamName String 
+  | ParamType FortranType 
+  | Space SpaceInfo 
+  Indexed [String]
   deriving Show
 
-data PPDFunctionSetProperty =
-  PPDData String |
-  PPDBasis String
+data PPDFunctionSetProperty 
+  = PPDData String 
+  PPDBasis String
   deriving Show
 
 data FortranFunction =
   FortranFunction String [FortranFunctionProperty]
   deriving Show
 
-data FortranFunctionProperty =
-  FortranFunctionName String |
-  FortranFunctionParams [String]
+data FortranFunctionProperty 
+  = FortranFunctionName String 
+  FortranFunctionParams [String]
   deriving Show
 
 findSpace :: [FortranParamProperty] -> Maybe SpaceInfo
index 850e89d50f45a79eadf64aa77c2cd56deb124c4b..0c923ff0c5a474c39fc40075c6d1cc31fbbc88f5 100644 (file)
@@ -44,15 +44,15 @@ import Data.Set (Set)
 import qualified Data.Set as Set
 
 -- The top-level types
-data BaseType 
-  RealType | 
-  FunctionType | 
-  IntegerType 
+data BaseType 
+  = RealType 
+  | FunctionType 
+  IntegerType 
   deriving (Show, Eq, Enum, Bounded)
 
-data GeneralType =
-  FieldType |
-  ScalarType
+data GeneralType 
+  = FieldType 
+  | ScalarType 
   deriving Show
 
 baseToGeneralType :: BaseType -> GeneralType
@@ -61,20 +61,20 @@ baseToGeneralType FunctionType = FieldType
 baseToGeneralType IntegerType = ScalarType
 
 -- Expressions
-data Expression = 
-  IndexedIdentifier String [String] |
-  ConstReal Double |
-  ConstInteger Integer |
-  Negate Expression | 
-  Integrate Expression | 
-  Sum Expression String |
-  Multiply Expression Expression |
-  Divide Expression Expression |
-  Add Expression Expression |
-  Sub Expression Expression |
-  Power Expression Expression |
-  PositionComponent String |
-  SpatialDerivative Expression String Integer
+data Expression
+  = IndexedIdentifier String [String]
+  | ConstReal Double
+  | ConstInteger Integer
+  | Negate Expression 
+  | Integrate Expression 
+  | Sum Expression String
+  | Multiply Expression Expression
+  | Divide Expression Expression
+  | Add Expression Expression
+  | Sub Expression Expression
+  | Power Expression Expression
+  | PositionComponent String
+  SpatialDerivative Expression String Integer
   deriving Show
 
 instance PrettyPrintable Expression where
@@ -98,8 +98,8 @@ instance PrettyPrintable Expression where
     binaryToDoc op lhs rhs = parens $ hcat [toDoc lhs, text op, toDoc rhs]
     functionToDoc name params = text name <> (parens $ hcat (intersperse (text ", ") params))
 
-data Assignment 
-  Assign Expression Expression 
+data Assignment 
+  Assign Expression Expression 
   deriving Show
 
 instance PrettyPrintable Assignment where
@@ -117,9 +117,9 @@ instance OFLKeyword IndexType where
   toOFLString indexType = show indexType
 
 -- The symbol table
-data SymbolType = 
-  ValueTag BaseType [IndexType] | 
-  IndexTag IndexType 
+data SymbolType
+  = ValueTag BaseType [IndexType]
+  IndexTag IndexType 
   deriving Show
 
 type SymbolTable = Map String SymbolType
@@ -278,7 +278,10 @@ emptyOFL = OFL {
 }
 
 -- Validation
-data ValidationError = Message String deriving Show
+data ValidationError 
+  = Message String
+  deriving Show
+
 type ValidationResult = Either ValidationError ()
 
 validationSuccess :: ValidationResult