packages feed

colorless (empty) → 0.0.0

raw patch · 4 files changed

+247/−0 lines, 4 filesdep +basedep +megaparsecdep +pregamesetup-changed

Dependencies added: base, megaparsec, pregame

Files

+ LICENSE view
@@ -0,0 +1,30 @@+Copyright Joe Vargas (c) 2016++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of Joe Vargas nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ colorless.cabal view
@@ -0,0 +1,60 @@+name:+  colorless+version:+  0.0.0+synopsis:+  Yet another IDL for RPC+description:+  Please see README.md+homepage:+  http://github.com/jxv/colorless#readme+license:+  BSD3+license-file:+  LICENSE+author:+  Joe Vargas+maintainer:+  http://github.com/jxv+copyright:+  2016 Joe Vargas+category:+  Web+build-type:+  Simple+-- extra-source-files:+cabal-version:+  >=1.10++library+  hs-source-dirs:+    src+  exposed-modules:+    Colorless.CodeGen.Types+  build-depends:+      base >= 4.7 && < 5+    , pregame == 1.0.3.0+    , megaparsec+  default-language:+    Haskell2010+  default-extensions:+    NoImplicitPrelude+    OverloadedStrings+    TypeSynonymInstances+    FlexibleInstances+    FlexibleContexts+    GeneralizedNewtypeDeriving+    LambdaCase+    ScopedTypeVariables+    NamedFieldPuns+    MultiParamTypeClasses+    TypeFamilies+    TupleSections+    DuplicateRecordFields+    OverloadedLists++source-repository head+  type:+    git+  location:+    https://github.com/jxv/colorless
+ src/Colorless/CodeGen/Types.hs view
@@ -0,0 +1,155 @@+module Colorless.CodeGen.Types+  (+  ) where++import Pregame++newtype FuncName = FuncName Text deriving (Show, Eq, Ord, IsString)+newtype ArgName = ArgName Text deriving (Show, Eq, Ord, IsString)+newtype Tag = Tag Text deriving (Show, Eq, Ord, IsString)+newtype SumName = SumName Text deriving (Show, Eq, Ord, IsString)+newtype SubtypeName = SubtypeName Text deriving (Show, Eq, Ord, IsString)+newtype FieldName = FieldName Text deriving (Show, Eq, Ord, IsString)+newtype OpaqueName = OpaqueName Text deriving (Show, Eq, Ord, IsString)+newtype TypeParamName = TypeParamName Text deriving (Show, Eq, Ord, IsString)+newtype Negative = Negative Integer deriving (Show, Eq, Num)+newtype Positive = Positive Integer deriving (Show, Eq, Num)+newtype Natural = Natural Integer deriving (Show, Eq, Num)+newtype Rational = Rational (Integer, Integer) deriving (Show, Eq)+newtype Version = Version (Integer, Integer, Integer) deriving (Show, Eq, Ord)+newtype HttpDirectory = HttpDirectory [Text] deriving (Show, Eq, Monoid)+newtype HttpPort = HttpPort Int deriving (Show, Eq)+newtype SpecName = SpecName Text deriving (Show, Eq, IsString)+newtype DomainName = DomainName Text deriving (Show, Eq, IsString)++data PrimType+  = PrimTypeUnit+  | PrimTypeU8+  | PrimTypeU16+  | PrimTypeU32+  | PrimTypeU64+  | PrimTypeI8+  | PrimTypeI16+  | PrimTypeI32+  | PrimTypeI64+  | PrimTypeF32+  | PrimTypeF64+  | PrimTypeBool+  | PrimTypeChar+  | PrimTypeStr+  | PrimTypeInt+  | PrimTypeNeg+  | PrimTypePos+  | PrimTypeNat+  | PrimTypeRat+  deriving (Show, Eq)++data PrimRef+  = PrimRefUnit+  | PrimRefU8 Word8+  | PrimRefU16 Word16+  | PrimRefU32 Word32+  | PrimRefU64 Word64+  | PrimRefI8 Int8+  | PrimRefI16 Int16+  | PrimRefI32 Int32+  | PrimRefI64 Int64+  | PrimRefF32 Float+  | PrimRefF64 Double+  | PrimRefBool Bool+  | PrimRefChar Char+  | PrimRefStr Text+  | PrimRefInt Integer+  | PrimRefNeg Negative+  | PrimRefPos Positive+  | PrimRefNat Natural+  | PrimRefRat Rational+  deriving (Show, Eq)++data Type+  = TypePrim PrimType+  | TypeOpaque OpaqueName+  deriving (Show, Eq)++data TypeRef+  = TypeRefPrimType PrimType+  | TypeRefOpaque OpaqueRef+  deriving (Show, Eq)++data TypeParamRef+  = TypeParamRefPrimRef PrimRef+  | TypeParamRefPrimType PrimType+  | TypeParamRefOpaqueRef OpaqueRef+  deriving (Show, Eq)++data TypeParam = TypeParam+  { _name :: TypeParamName+  , _ref :: TypeParamRef+  } deriving (Show, Eq)++data OpaqueRef = OpaqueRef+  { _name :: OpaqueName+  , _params :: [TypeParamRef]+  } deriving (Show, Eq)++data FuncDef = FuncDef+  { _args :: [(ArgName, TypeRef)]+  , _tags :: Set Tag+  } deriving (Show, Eq)++data SumDef = SumDef+  { _params :: [TypeParamRef]+  , _subtypes :: Map SubtypeName [TypeRef]+  , _tags :: Set Tag+  } deriving (Show, Eq)++data ProductDef = ProductDef+  { _params :: [TypeParamRef]+  , _fields :: Map FieldName TypeRef+  , _tags :: Set Tag+  } deriving (Show, Eq)++data OpaqueDef+  = OpaqueDefSum SumDef+  | OpaqueDefProduct ProductDef+  deriving (Show, Eq)++data ServiceDef = ServiceDef+  { _opaques :: Map OpaqueName OpaqueDef+  , _funcs :: Map FuncName FuncDef+  , _tags :: Set Tag+  } deriving (Show, Eq)++data HttpFormat+  = HttpFormatJson+  deriving (Show, Eq)++data HttpMeta+  = HttpMetaHeader+  deriving (Show, Eq)++data HttpImpl = HttpImpl+  { _directory :: HttpDirectory+  , _port :: HttpPort+  , _meta :: HttpMeta+  , _format :: HttpFormat+  } deriving (Show, Eq)++data Impl+  = ImplHttp HttpImpl+  deriving (Show, Eq)++data Domain = Domain+  { _name :: DomainName+  , _service :: ServiceDef+  , _impl :: Impl+  } deriving (Show, Eq)++data SpecDef = SpecDef+  { _name :: SpecName+  , _domains :: [Domain]+  } deriving (Show, Eq)++data Specs = Specs+  { _defs :: Map Version SpecDef+  } deriving (Show, Eq)