packages feed

domain 0.1.1 → 0.1.1.1

raw patch · 4 files changed

+25/−6 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

README.md view
@@ -4,7 +4,7 @@  # Problem -Imagine a real-life project, where you have to define the types for your problem domain: your **domain model**. How many types do you think there'll be? [A poll among Haskellers](https://twitter.com/NikitaYVolkov/status/1324360237827108870) shows that highly likely more than 30. That is 30 places for you to derive or define instances, work around the records problem and the problem of conflicting constructor names. That is a lot of boilerplate and noise, distracting you from your actual goal of modeling the data structures or learning an existing model during maintenance. Also don't forget about the boilerplate required to generate optics for your model to actually make it accessible.+Imagine a real-life project, where you have to define the types for your problem domain: your domain model. How many types do you think there'll be? [A poll among Haskellers](https://twitter.com/NikitaYVolkov/status/1324360237827108870) shows that highly likely more than 30. That is 30 places for you to derive or define instances, work around the records problem and the problem of conflicting constructor names. That is a lot of boilerplate and noise, distracting you from your actual goal of modeling the data structures or learning an existing model during maintenance. Also don't forget about the boilerplate required to generate optics for your model to actually make it accessible.  # Mission @@ -89,7 +89,7 @@     part2: Word64 ``` -As you can see in the specification above we're not concerned with typeclass instances or problems of name disambiguation. We're only concerned with data and relations that it has. This is what we meant by focus. It makes the experience of designing and maintaining a model way smoother.+As you can see in the specification above we're not concerned with typeclass instances or problems of name disambiguation. We're only concerned with data and relations that it has. This is what we mean by focus. It makes the experience of designing and maintaining a model distraction free.  Those three methods of defining types (product, sum, enum) are all that you need to define a model of any complexity. If you understand them, there's nothing new to learn. 
domain.cabal view
@@ -1,5 +1,5 @@ name: domain-version: 0.1.1+version: 0.1.1.1 synopsis: Codegen helping you define domain models description:   - For introduction and demo skip to [Readme](#readme).@@ -37,6 +37,7 @@     Domain.Models.TypeString     Domain.Prelude     Domain.Resolvers.TypeCentricDoc+    Domain.Text     Domain.TH.InstanceDec     Domain.TH.InstanceDecs     Domain.TH.TypeDec
library/Domain/Resolvers/TypeCentricDoc.hs view
@@ -6,6 +6,7 @@ import qualified Domain.Models.TypeCentricDoc as Doc import qualified Domain.Models.TypeString as TypeString import qualified Data.Text as Text+import qualified Domain.Text as Text   eliminateDoc :: Applicative f => Doc.Doc -> f [TypeDec]@@ -28,10 +29,10 @@ structureGeneratedTypeDecs namespace =   \ case     Doc.ProductStructure structure ->-      traverse (uncurry (nestedTypeExpressionTypeDecs namespace . Text.toTitle)) structure+      traverse (uncurry (nestedTypeExpressionTypeDecs namespace . Text.ucFirst)) structure         & fmap join     Doc.SumStructure structure ->-      traverse (\(a, b) -> traverse (nestedTypeExpressionTypeDecs namespace (Text.toTitle a)) b) structure+      traverse (\(a, b) -> traverse (nestedTypeExpressionTypeDecs namespace (Text.ucFirst a)) b) structure         & fmap (join . join)     _ ->       pure []@@ -67,7 +68,7 @@     Doc.AppSeqNestedTypeExpression a ->       AppType <$> eliminateTypeStringAppSeq a     Doc.StructureNestedTypeExpression _ ->-      pure (RefType (Text.concat (reverse (Text.toTitle name : namespace))))+      pure (RefType (Text.concat (reverse (Text.ucFirst name : namespace))))  eliminateTypeStringCommaSeq =   traverse eliminateTypeStringAppSeq
+ library/Domain/Text.hs view
@@ -0,0 +1,17 @@+module Domain.Text+where++import Domain.Prelude+import Data.Text+import qualified Data.Char as Char+++mapFirstChar fn =+  foldMap (\ (a, b) -> cons (fn a) b) .+  uncons++ucFirst =+  mapFirstChar Char.toUpper++lcFirst =+  mapFirstChar Char.toLower