@@ -1,7 +1,14 @@
1{-# OPTIONS_GHC -Wall #-}
1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE OverloadedStrings #-}
3−module AST.Literal where
3+module AST.Literal
6+ , GLType(..), glTypeToText, Shader(..)
5import qualified Data.Map as Map
12import qualified Data.Map as Map
6import Data.Monoid ((<>))
13import Data.Monoid ((<>))
7import Data.Text (Text)
14import Data.Text (Text)
@@ -37,6 +44,15 @@ toBuilder literal =
37-- WebGL TYPES
44-- WebGL TYPES
49+ { attribute :: Map.Map Text GLType
50+ , uniform :: Map.Map Text GLType
51+ , varying :: Map.Map Text GLType
40data GLType
56data GLType
@@ -60,10 +76,38 @@ glTypeToText glTipe =
60 Texture -> "WebGL.Texture"
76 Texture -> "WebGL.Texture"
65− { attribute :: Map.Map Text GLType
81+
66− , uniform :: Map.Map Text GLType
82+
67− , varying :: Map.Map Text GLType
83+instance Binary Literal where
69− deriving (Eq)
85+ case literal of
87+ putWord8 0 >> put chr
90+ putWord8 1 >> put str
110+ 3 -> FloatNum <$> get
111+ 4 -> pure $ Boolean True
112+ 5 -> pure $ Boolean False
113+ _ -> error "bad binary for AST.Literal"