blob: 656d56b04598d4e5f686f40f2a0fc791c8b0fdb3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
module Fun.Typer where
data Type = UnknownType | NormalType String | InternalType String | ListType Type
deriving (Show, Eq)
-- TODO: Struct (like 'data' with mutiple), Union (like 'data' with '|')
-- TODO: Handle primary types as normal non-primary types?
sizeOfNormalType :: String -> Integer
sizeOfNormalType "Signed64" = 64
sizeOfNormalType "Signed32" = 32
sizeOfNormalType "Signed16" = 16
sizeOfNormalType "Signed8" = 8
sizeOfNormalType "Unsigned64" = 64
sizeOfNormalType "Unsigned32" = 32
sizeOfNormalType "Unsigned16" = 16
sizeOfNormalType "Unsigned8" = 8
sizeOfNormalType _ = 0
resolveType :: String -> Type
resolveType t@('_' : _) = InternalType t
resolveType t = NormalType t
|