summaryrefslogtreecommitdiff
path: root/src/Language/Fiddle/Internal/UnitInterface.hs
blob: 1f12c4c5abf997aef71a375fa5a59652558d9907 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module Language.Fiddle.Internal.UnitInterface where

import Data.Text
import Data.Word
import Language.Fiddle.Internal.Scopes (Scope)
import Language.Fiddle.Types (SourceSpan)

data Annotated a = Annotated
  { sourceSpan :: SourceSpan,
    docComment :: Text,
    internal :: a
  }
  deriving (Eq, Ord, Show)

-- | Contains a datastructure which represents a FiddleUnit.
--
-- These datastructures contain the exported symobls of a fiddle unit and it's
-- direct dependencies.
data UnitInterface where
  UnitInterface ::
    { rootScope :: Scope String (Annotated ExportedValue),
      dependencies :: [FilePath]
    } ->
    UnitInterface
  deriving (Eq, Ord, Show)

data ExportedValue where
  ExportedBitsType ::
    {exportBitsTypeSize :: Word32} ->
    ExportedValue
  ExportedObjType ::
    {exportObjTypeSize :: Word32} ->
    ExportedValue
  deriving (Show, Eq, Ord)