on master help sign in
Add one Example for each Monoid/Semigroup newtype to UnitTests
commit8eec675c607e484aebacce971ac8f38bf81f8301 authorLennart Spitzner <lsp@informatik.uni-kiel.de> dateMon 15 Aug 2016, 21:30 (10 years ago) parent168c4c0
1 file changed+14
tests/UnitTests.hs+14
tests/UnitTests.hs+14
@@ -59,6 +59,8 @@ import qualified Data.HashSet as HashSet
5959import qualified Data.IntMap as IntMap
6060import qualified Data.IntSet as IntSet
6161import qualified Data.Map as M
62+import qualified Data.Monoid as Monoid
63+import qualified Data.Semigroup as Semigroup
6264import qualified Data.Sequence as Seq
6365import qualified Data.Set as Set
6466import qualified Data.Text.Lazy as LT
@@ -419,6 +421,18 @@ jsonExamples =
419421
420422 , Example "MyEither Int String: Left" "42" (MyLeft 42 :: MyEither Int String)
421423 , Example "MyEither Int String: Right" "\"foo\"" (MyRight "foo" :: MyEither Int String)
424+
425+ -- newtypes from Monoid/Semigroup
426+ , Example "Monoid.Dual Int" "2" (pure 2 :: Monoid.Dual Int)
427+ , Example "Monoid.First Int" "2" (pure 2 :: Monoid.First Int)
428+ , Example "Monoid.Last Int" "2" (pure 2 :: Monoid.Last Int)
429+ , Example "Semigroup.Min Int" "2" (pure 2 :: Semigroup.Min Int)
430+ , Example "Semigroup.Max Int" "2" (pure 2 :: Semigroup.Max Int)
431+ , Example "Semigroup.First Int" "2" (pure 2 :: Semigroup.First Int)
432+ , Example "Semigroup.Last Int" "2" (pure 2 :: Semigroup.Last Int)
433+ , Example "Semigroup.WrappedMonoid Int" "2" (Semigroup.WrapMonoid 2 :: Semigroup.WrappedMonoid Int)
434+ , Example "Semigroup.Option Just" "2" (pure 2 :: Semigroup.Option Int)
435+ , Example "Semigroup.Option Nothing" "null" (Semigroup.Option (Nothing :: Maybe Bool))
422436 ]
423437
424438