diff options
author | Joe Crayne <joe@jerkface.net> | 2019-04-13 22:57:29 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-04-13 22:57:54 -0400 |
commit | 7025ff0800de5725badbdeffc81fdf455abdd6b2 (patch) | |
tree | 2ffe5b8583f0a4d980266770b7bb8f9628563475 | |
parent | 52dd131bbcacaa2b7de795641ecf69a1a10b1494 (diff) |
aliased signatures.
-rw-r--r-- | ddl/Definitions.hs | 13 | ||||
-rw-r--r-- | ddl/Language.hs | 3 |
2 files changed, 8 insertions, 8 deletions
diff --git a/ddl/Definitions.hs b/ddl/Definitions.hs index 56fb6ee..5c9efa8 100644 --- a/ddl/Definitions.hs +++ b/ddl/Definitions.hs | |||
@@ -2,10 +2,9 @@ | |||
2 | module Definitions (modules) where | 2 | module Definitions (modules) where |
3 | 3 | ||
4 | import Control.Monad.Writer | 4 | import Control.Monad.Writer |
5 | import Data.Functor.Identity | ||
6 | import Language | 5 | import Language |
7 | 6 | ||
8 | ir :: WriterT ([DataDef], [String]) Identity () | 7 | ir :: DDef () |
9 | ir = do | 8 | ir = do |
10 | -- type aliases | 9 | -- type aliases |
11 | "StreamName" #= Int | 10 | "StreamName" #= Int |
@@ -436,7 +435,7 @@ ir = do | |||
436 | ] | 435 | ] |
437 | deriving_ [Haskell] [Show] | 436 | deriving_ [Haskell] [Show] |
438 | 437 | ||
439 | mesh :: WriterT ([DataDef], [String]) Identity () | 438 | mesh :: DDef () |
440 | mesh = do | 439 | mesh = do |
441 | data_ "MeshAttribute" $ do | 440 | data_ "MeshAttribute" $ do |
442 | const_ "A_Float" [Array Float] | 441 | const_ "A_Float" [Array Float] |
@@ -462,7 +461,7 @@ mesh = do | |||
462 | , "mPrimitive" #:: "MeshPrimitive" | 461 | , "mPrimitive" #:: "MeshPrimitive" |
463 | ] | 462 | ] |
464 | 463 | ||
465 | typeInfo :: WriterT ([DataDef], [String]) Identity () | 464 | typeInfo :: DDef () |
466 | typeInfo = do | 465 | typeInfo = do |
467 | data_ "Range" $ do | 466 | data_ "Range" $ do |
468 | constR_ "Range" | 467 | constR_ "Range" |
@@ -494,7 +493,7 @@ typeInfo = do | |||
494 | const_ "CompileError" [String, Array "TypeInfo", Array "WarningInfo", Array "ErrorInfo"] | 493 | const_ "CompileError" [String, Array "TypeInfo", Array "WarningInfo", Array "ErrorInfo"] |
495 | const_ "Compiled" [String, String, "Pipeline", Array "TypeInfo", Array "WarningInfo"] | 494 | const_ "Compiled" [String, String, "Pipeline", Array "TypeInfo", Array "WarningInfo"] |
496 | 495 | ||
497 | pipelineSchema :: WriterT ([DataDef], [String]) Identity () | 496 | pipelineSchema :: DDef () |
498 | pipelineSchema = do | 497 | pipelineSchema = do |
499 | data_ "StreamType" $ do | 498 | data_ "StreamType" $ do |
500 | enum_ "Attribute_Word" | 499 | enum_ "Attribute_Word" |
@@ -532,7 +531,7 @@ pipelineSchema = do | |||
532 | , "uniforms" #:: Map String "InputType" | 531 | , "uniforms" #:: Map String "InputType" |
533 | ] | 532 | ] |
534 | 533 | ||
535 | testData :: WriterT ([DataDef], [String]) Identity () | 534 | testData :: DDef () |
536 | testData = do | 535 | testData = do |
537 | -- client info | 536 | -- client info |
538 | data_ "ClientInfo" $ do | 537 | data_ "ClientInfo" $ do |
@@ -584,7 +583,7 @@ testData = do | |||
584 | const_ "RenderJobResult" ["FrameResult"] | 583 | const_ "RenderJobResult" ["FrameResult"] |
585 | const_ "RenderJobError" [String] | 584 | const_ "RenderJobError" [String] |
586 | 585 | ||
587 | modules :: WriterT [ModuleDef] Identity () | 586 | modules :: MDef () |
588 | modules = do | 587 | modules = do |
589 | module_ "LambdaCube.IR" ir | 588 | module_ "LambdaCube.IR" ir |
590 | module_ "LambdaCube.PipelineSchema" $ do | 589 | module_ "LambdaCube.PipelineSchema" $ do |
diff --git a/ddl/Language.hs b/ddl/Language.hs index 9701023..816bbb9 100644 --- a/ddl/Language.hs +++ b/ddl/Language.hs | |||
@@ -387,6 +387,7 @@ data_ n l = tell ([let (c,i) = execWriter l in DataDef n c i],mempty) | |||
387 | alias_ :: String -> Type -> DDef () | 387 | alias_ :: String -> Type -> DDef () |
388 | alias_ n t = tell ([TypeAlias n t],mempty) | 388 | alias_ n t = tell ([TypeAlias n t],mempty) |
389 | 389 | ||
390 | (#=) :: String -> Type -> DDef () | ||
390 | a #= b = alias_ a b | 391 | a #= b = alias_ a b |
391 | 392 | ||
392 | class IsField a where | 393 | class IsField a where |
@@ -449,4 +450,4 @@ a #:: b = Field a b | |||
449 | serialization: | 450 | serialization: |
450 | json: encode/decode | 451 | json: encode/decode |
451 | other? | 452 | other? |
452 | -} \ No newline at end of file | 453 | -} |