ATTR Module
   [   dictionaryEnv    : DictionaryEnvironment
       extraDecls       : { [Core.CoreDecl] }
       importEnv        : ImportEnvironment
       toplevelTypes    : TypeEnvironment
   |
   |   core             : { Core.CoreModule }
   ]

-- UHA
INCLUDE "../syntax/UHA_Syntax.ag"

-- Transformation into Core
INCLUDE "ToCoreModule.ag"
INCLUDE "ToCoreDecl.ag"
INCLUDE "ToCoreExpr.ag"
INCLUDE "ToCorePat.ag"
INCLUDE "ToCoreName.ag"

imports{
import UHA_Syntax
import UHA_Utils
import UHA_Range 
import List (union)
import ImportEnvironment
import DictionaryEnvironment
import qualified Data.Map as M
import TypeConversion
import Char (ord)

import Id
import IdSet 
import Utils(internalError)

import Top.Types

import PatternMatch
import DerivingShow
import DerivingEq

-- Semi-Daan
import CoreUtils

-- Daan
import qualified Core
import qualified Module
import qualified Byte
import qualified CoreParse
}

{

type CoreDecl = Core.Decl Core.Expr
}

--Collect.ag

ATTR Body Declarations Declaration Expressions Expression Statements Statement
     Qualifiers Qualifier GuardedExpressions GuardedExpression 
     Alternatives Alternative FunctionBindings FunctionBinding
     RightHandSide MaybeDeclarations MaybeExpression RecordExpressionBinding
     RecordExpressionBindings Constructors Constructor
    [ dictionaryEnv : DictionaryEnvironment | | ]

ATTR Body Declarations Declaration Constructor Constructors
    [ importEnv     : ImportEnvironment | | ]
    
SEM Expression        | Let  loc.importEnv = internalError "CodeGeneration.ag" "Expression.Let" ""
SEM MaybeDeclarations | Just loc.importEnv = internalError "CodeGeneration.ag" "MaybeDeclarations.Just" ""      
SEM Qualifier         | Let  loc.importEnv = internalError "CodeGeneration.ag" "Qualifier.Let" ""       
SEM Statement         | Let  loc.importEnv = internalError "CodeGeneration.ag" "Statement.Let" ""       

ATTR SimpleType [ | | name:Name typevariables:Names ]

SEM SimpleType
  | SimpleType  lhs . name          = @name.self                   
                    . typevariables = @typevariables.self
