Skip to content

Commit 0a96e00

Browse files
committed
Cut commented out code. Comment monoid instance.
Following suggestions made at: [pull/139#discussion_r158537349](#139 (comment)) and [pull/139#discussion_r158537230](#139 (comment)) and [pull/139#discussion_r158537382](#139 (comment))
1 parent a8cd01f commit 0a96e00

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/GraphQL/Internal/Name.hs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,14 @@ import GraphQL.Internal.Syntax.Tokens (tok)
3636
-- https://facebook.github.io/graphql/#sec-Names
3737
newtype Name = Name { unName :: T.Text } deriving (Eq, Ord, Show)
3838

39+
-- | Allow Name to be parsed with `optempty`
40+
--
41+
-- Example: node = AST.Node <$> optempty nameParser
42+
-- I.e. If nameParser fails, the Name field of AST.Node is set
43+
-- mempty rather than propagating a failure.
3944
instance Monoid Name where
4045
mempty = Name T.empty
41-
-- mappend (Name {a}) mempty = Name {a}
42-
-- mappend mempty (Name {b}) = Name {b}
4346
mappend (Name a1) (Name a2) = Name (T.append a1 a2)
44-
-- mappend = append
45-
-- mconcat = concat
46-
47-
--newtype Any = Any { getAny :: Bool }
48-
49-
--instance Monoid Any where
50-
-- mempty = Any False
51-
-- (Any b1) `mappend` (Any b2) = Any (b1 || b2)
5247

5348
-- | Create a 'Name', panicking if the given text is invalid.
5449
--

0 commit comments

Comments
 (0)