ren-lang / compiler / Ren.AST.Module


type alias Module meta =
{ name : String
, imports : List Import
, declarations : List (Declaration meta) 
}


type alias Import =
{ path : ImportSpecifier
, name : List String
, exposed : List String 
}


type ImportSpecifier
    = ExternalImport String
    | LocalImport String
    | PackageImport String
    | FfiImport


type Declaration meta
    = Ext Basics.Bool String Ren.Data.Type.Type meta
    | Let Basics.Bool String Ren.Data.Type.Type (Ren.AST.Expr.Expr meta) meta
    | Run (Ren.AST.Expr.Expr meta) meta
    | Type Basics.Bool String (List String) TypeDeclaration meta


type TypeDeclaration
    = Enum (Dict String (List Ren.Data.Type.Type))
    | Record (Dict String Ren.Data.Type.Type)
    | Abstract

exposes : String -> Module meta -> Basics.Bool

imports : ImportSpecifier -> Module meta -> Basics.Bool

externs : Module meta -> List String

map : (Declaration a -> Declaration b) -> Module a -> Module b

mapImports : (Import -> Import) -> Module meta -> Module meta