Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-volkov authored and github-actions[bot] committed Dec 9, 2023
1 parent 16aa07e commit e61d868
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 33 deletions.
20 changes: 9 additions & 11 deletions library/Domain/Models/TypeCentricDoc.hs
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
module Domain.Models.TypeCentricDoc
where
module Domain.Models.TypeCentricDoc where

import Domain.Prelude hiding (Product, Sum, Enum)
import qualified Domain.Models.TypeString as TypeString

import Domain.Prelude hiding (Enum, Product, Sum)

type Doc =
[(Text, Structure)]

data Structure =
ProductStructure [(Text, NestedTypeExpression)] |
SumStructure [(Text, [NestedTypeExpression])] |
EnumStructure [Text]
data Structure
= ProductStructure [(Text, NestedTypeExpression)]
| SumStructure [(Text, [NestedTypeExpression])]
| EnumStructure [Text]
deriving (Show)

data NestedTypeExpression =
AppSeqNestedTypeExpression TypeString.AppSeq |
StructureNestedTypeExpression Structure
data NestedTypeExpression
= AppSeqNestedTypeExpression TypeString.AppSeq
| StructureNestedTypeExpression Structure
deriving (Show)
12 changes: 5 additions & 7 deletions library/Domain/Models/TypeString.hs
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
module Domain.Models.TypeString
where
module Domain.Models.TypeString where

import Domain.Prelude


type CommaSeq =
[AppSeq]

type AppSeq =
NonEmpty Unit

data Unit =
InSquareBracketsUnit AppSeq |
InParensUnit CommaSeq |
RefUnit (NonEmpty Text)
data Unit
= InSquareBracketsUnit AppSeq
| InParensUnit CommaSeq
| RefUnit (NonEmpty Text)
deriving (Show)
6 changes: 2 additions & 4 deletions library/Domain/Util/List.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module Domain.Util.List
where
module Domain.Util.List where

import Domain.Prelude
import Data.List

import Domain.Prelude

unsnoc :: [a] -> Maybe ([a], a)
unsnoc =
Expand Down
23 changes: 12 additions & 11 deletions test/Util/TH.hs
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
module Util.TH where

import Prelude
import Language.Haskell.TH.Syntax as TH
import Language.Haskell.TH.Quote as TH
import qualified Domain
import qualified DomainCore.Model as Model

import Language.Haskell.TH.Quote as TH
import Language.Haskell.TH.Syntax as TH
import Prelude

tryQuoteExp :: QuasiQuoter -> String -> Q Exp
tryQuoteExp q =
recover (pure (ConE 'Nothing)) .
fmap (AppE (ConE 'Just)) .
quoteExp q
recover (pure (ConE 'Nothing))
. fmap (AppE (ConE 'Just))
. quoteExp q

tryExpQ :: Q Exp -> Q Exp
tryExpQ =
recover (pure (ConE 'Nothing)) .
fmap (AppE (ConE 'Just))
recover (pure (ConE 'Nothing))
. fmap (AppE (ConE 'Just))

mapQQExpQ :: (Q Exp -> Q Exp) -> QuasiQuoter -> QuasiQuoter
mapQQExpQ mapper (QuasiQuoter a b c d) =
Expand All @@ -28,8 +27,10 @@ maybeDecsQQ =
where
mapper =
AppE
(AppE (VarE 'fmap)
(SigE (VarE 'unsafeCoerce) sig))
( AppE
(VarE 'fmap)
(SigE (VarE 'unsafeCoerce) sig)
)
where
sig =
AppT
Expand Down

0 comments on commit e61d868

Please sign in to comment.