@@ -6,11 +6,9 @@ module Text.Markdown.SlamDown.Syntax.Block
66
77import Prelude
88
9+ import Data.Eq (class Eq1 )
910import Data.List as L
10-
11- import Test.StrongCheck.Arbitrary as SCA
12- import Test.StrongCheck.Gen as Gen
13-
11+ import Data.Ord (class Ord1 )
1412import Text.Markdown.SlamDown.Syntax.Inline (Inline )
1513
1614data Block a
@@ -22,18 +20,9 @@ data Block a
2220 | LinkReference String String
2321 | Rule
2422
25- instance functorBlock ∷ Functor Block where
26- map f x =
27- case x of
28- Paragraph is → Paragraph (map f <$> is)
29- Header n is → Header n (map f <$> is)
30- Blockquote bs → Blockquote (map f <$> bs)
31- Lst ty bss → Lst ty (map (map f) <$> bss)
32- CodeBlock ty ss → CodeBlock ty ss
33- LinkReference l uri → LinkReference l uri
34- Rule → Rule
23+ derive instance functorBlock ∷ Functor Block
3524
36- instance showBlock ∷ ( Show a ) ⇒ Show (Block a ) where
25+ instance showBlock ∷ Show a ⇒ Show (Block a ) where
3726 show (Paragraph is) = " (Paragraph " <> show is <> " )"
3827 show (Header n is) = " (Header " <> show n <> " " <> show is <> " )"
3928 show (Blockquote bs) = " (Blockquote " <> show bs <> " )"
@@ -42,24 +31,10 @@ instance showBlock ∷ (Show a) ⇒ Show (Block a) where
4231 show (LinkReference l uri) = " (LinkReference " <> show l <> " " <> show uri <> " )"
4332 show Rule = " Rule"
4433
45- derive instance eqBlock ∷ (Eq a , Ord a ) ⇒ Eq (Block a )
46- derive instance ordBlock ∷ (Ord a ) ⇒ Ord (Block a )
47-
48- -- | Nota bene: this does not generate any recursive structure
49- instance arbitraryBlock ∷ (SCA.Arbitrary a , Eq a ) ⇒ SCA.Arbitrary (Block a ) where
50- arbitrary = do
51- k ← Gen .chooseInt 0 6
52- case k of
53- 0 → Paragraph <$> listOf SCA .arbitrary
54- 1 → Header <$> SCA .arbitrary <*> listOf SCA .arbitrary
55- 2 → pure $ Blockquote L.Nil
56- 3 → Lst <$> SCA .arbitrary <*> listOf (pure L.Nil )
57- 4 → CodeBlock <$> SCA .arbitrary <*> listOf SCA .arbitrary
58- 5 → LinkReference <$> SCA .arbitrary <*> SCA .arbitrary
59- _ → pure Rule
60-
61- listOf ∷ ∀ f a . (Monad f ) ⇒ Gen.GenT f a → Gen.GenT f (L.List a )
62- listOf = map L .fromFoldable <<< Gen .arrayOf
34+ derive instance eqBlock ∷ Eq a ⇒ Eq (Block a )
35+ derive instance eq1Block ∷ Eq1 Block
36+ derive instance ordBlock ∷ Ord a ⇒ Ord (Block a )
37+ derive instance ord1Block ∷ Ord1 Block
6338
6439data ListType
6540 = Bullet String
@@ -72,11 +47,6 @@ instance showListType ∷ Show ListType where
7247derive instance eqListType ∷ Eq ListType
7348derive instance ordListType ∷ Ord ListType
7449
75- instance arbitraryListType ∷ SCA.Arbitrary ListType where
76- arbitrary = do
77- b ← SCA .arbitrary
78- if b then Bullet <$> SCA .arbitrary else Ordered <$> SCA .arbitrary
79-
8050data CodeBlockType
8151 = Indented
8252 | Fenced Boolean String
@@ -87,8 +57,3 @@ instance showCodeBlockType ∷ Show CodeBlockType where
8757
8858derive instance eqCodeBlockType ∷ Eq CodeBlockType
8959derive instance ordCodeBlockType ∷ Ord CodeBlockType
90-
91- instance arbitraryCodeBlockType ∷ SCA.Arbitrary CodeBlockType where
92- arbitrary = do
93- b ← SCA .arbitrary
94- if b then pure Indented else Fenced <$> SCA .arbitrary <*> SCA .arbitrary
0 commit comments