Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
Updates for PureScript v0.11 (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
natefaubion authored Apr 21, 2017
1 parent d89cc23 commit fcc5c05
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 46 deletions.
22 changes: 11 additions & 11 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
"package.json"
],
"dependencies": {
"purescript-const": "^2.0.0",
"purescript-functors": "^1.1.0",
"purescript-lists": "^3.4.0",
"purescript-parsing": "^3.2.1",
"purescript-const": "^3.0.0",
"purescript-functors": "^2.0.0",
"purescript-lists": "^4.0.0",
"purescript-parsing": "^4.0.0",
"purescript-partial": "^1.2.0",
"purescript-precise": "^1.1.0",
"purescript-prelude": "^2.5.0",
"purescript-sets": "^2.0.1",
"purescript-strings": "^2.1.0",
"purescript-strongcheck": "^2.1.0",
"purescript-validation": "^2.0.0",
"purescript-datetime": "^2.2.0"
"purescript-precise": "^2.0.0",
"purescript-prelude": "^3.0.0",
"purescript-sets": "^3.0.0",
"purescript-strings": "^3.0.0",
"purescript-strongcheck": "^3.0.0",
"purescript-validation": "^3.0.0",
"purescript-datetime": "^3.0.0"
}
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"private": true,
"scripts": {
"clean": "rimraf output && rimraf .pulp-cache",
"build": "pulp build --censor-lib --strict",
"build": "pulp build -- --censor-lib --strict",
"test": "pulp test"
},
"devDependencies": {
"pulp": "^9.0.1",
"purescript": "^0.10.1",
"purescript-psa": "^0.3.9",
"pulp": "^11.0.0",
"purescript": "^0.11.4",
"purescript-psa": "^0.5.0",
"rimraf": "^2.5.4"
}
}
3 changes: 2 additions & 1 deletion src/Text/Markdown/SlamDown/Eval.purs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ type LanguageId = String

eval
m a
. (Monad m, SD.Value a)
. Monad m
SD.Value a
{ codeM.Maybe LanguageId String m a
, textBoxSD.TextBox (Const String) m (SD.TextBox Identity)
, valueString m a
Expand Down
22 changes: 11 additions & 11 deletions src/Text/Markdown/SlamDown/Parser/Inline.purs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ inlines = L.many inline2 <* PS.eof
String
P.Parser String (SD.Inline a)
emphasis p f s = do
PS.string s
_ ← PS.string s
f <$> PC.manyTill p (PS.string s)

emph P.Parser String (SD.Inline a) P.Parser String (SD.Inline a)
Expand Down Expand Up @@ -230,7 +230,7 @@ inlines = L.many inline2 <* PS.eof

autolink P.Parser String (SD.Inline a)
autolink = do
PS.string "<"
_ ← PS.string "<"
url ← (S.fromCharArray <<< A.fromFoldable) <$> (PS.anyChar `PC.many1Till` PS.string ">")
pure $ SD.Link (L.singleton $ SD.Str (autoLabel url)) (SD.InlineLink url)
where
Expand All @@ -241,7 +241,7 @@ inlines = L.many inline2 <* PS.eof

entity P.Parser String (SD.Inline a)
entity = do
PS.string "&"
_ ← PS.string "&"
s ← (S.fromCharArray <<< A.fromFoldable) <$> (PS.noneOf (S.toCharArray ";") `PC.many1Till` PS.string ";")
pure $ SD.Entity $ "&" <> s <> ";"

Expand All @@ -254,7 +254,7 @@ inlines = L.many inline2 <* PS.eof
required
fe ← do
PU.skipSpaces
PS.string "="
_ ← PS.string "="
PU.skipSpaces
formElement
pure $ map (SD.FormField l r) fe
Expand Down Expand Up @@ -288,7 +288,7 @@ inlines = L.many inline2 <* PS.eof
case mdef of
M.Just def → do
PU.skipSpaces
PS.string ")"
_ ← PS.string ")"
pure $ Right $ SD.TextBox $ SD.transTextBox (M.Just >>> Compose) def
M.Nothing
pure $ Left case template of
Expand Down Expand Up @@ -319,21 +319,21 @@ inlines = L.many inline2 <* PS.eof

where
parseDateTimeTemplate prec = do
parseDateTemplate
_ ← parseDateTemplate
PU.skipSpaces
parseTimeTemplate prec

parseDateTemplate = do
und
_ ← und
PU.skipSpaces *> dash *> PU.skipSpaces
und
_ ← und
PU.skipSpaces *> dash *> PU.skipSpaces
und

parseTimeTemplate prec = do
und
_ ← und
PU.skipSpaces *> colon *> PU.skipSpaces
und
_ ← und
when (prec == SD.Seconds) do
PU.skipSpaces *> colon *> PU.skipSpaces
void und
Expand Down Expand Up @@ -535,6 +535,6 @@ expr f p =

unevaluated b. P.Parser String (SD.Expr b)
unevaluated = do
PS.string "!"
_ ← PS.string "!"
ticks ← someOf (\x → S.singleton x == "`")
SD.Unevaluated <<< S.fromCharArray <<< A.fromFoldable <$> PC.manyTill PS.anyChar (PS.string ticks)
4 changes: 2 additions & 2 deletions src/Text/Markdown/SlamDown/Parser/References.purs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ linkReference ∷ ∀ a. P.Parser String (SD.Block a)
linkReference = do
l ←
charsToString <$> do
PS.string "["
_ ← PS.string "["
PU.skipSpaces
PC.manyTill PS.anyChar (PS.string "]")
PS.string ":"
_ ← PS.string ":"
PU.skipSpaces
uri ← charsToString <$> PC.manyTill PS.anyChar PS.eof
pure $ SD.LinkReference l uri
Expand Down
24 changes: 17 additions & 7 deletions src/Text/Markdown/SlamDown/Syntax/FormField.purs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ module Text.Markdown.SlamDown.Syntax.FormField
import Prelude

import Data.Array as A
import Data.Eq (class Eq1)
import Data.Functor.Compose (Compose(..))
import Data.Identity (Identity(..))
import Data.List as L
import Data.Maybe as M
import Data.Newtype (unwrap)
import Data.Ord (class Ord1)
import Data.Set as Set
import Data.Traversable as TR
import Data.Tuple (uncurry)
Expand Down Expand Up @@ -51,7 +53,7 @@ transFormField eta =

traverseFormField
f g h a
. (Applicative h)
. Applicative h
( x. f x h (g x))
FormFieldP f a
h (FormFieldP g a)
Expand Down Expand Up @@ -220,18 +222,18 @@ instance coarbitraryFormFieldIdentity ∷ (SCA.Coarbitrary a) ⇒ SCA.Coarbitrar
case field of
TextBox tb → SCA.coarbitrary $ TB.transTextBox (unwrap >>> map (unwrap >>> ArbIdentity) >>> ArbCompose) tb
RadioButtons x xs → \gen → do
SCA.coarbitrary (ArbIdentity $ unwrap x) gen
_← SCA.coarbitrary (ArbIdentity $ unwrap x) gen
SCA.coarbitrary (ArbIdentity $ unwrap xs) gen
CheckBoxes sel xs → \gen → do
SCA.coarbitrary (ArbIdentity $ unwrap sel) gen
_← SCA.coarbitrary (ArbIdentity $ unwrap sel) gen
SCA.coarbitrary (ArbIdentity $ unwrap xs) gen
DropDown mx xs → \gen → do
SCA.coarbitrary (ArbIdentity <<< unwrap <$> mx) gen
_← SCA.coarbitrary (ArbIdentity <<< unwrap <$> mx) gen
SCA.coarbitrary (ArbIdentity $ unwrap xs) gen

listOf1
f a
. (Monad f)
. Monad f
Gen.GenT f a
Gen.GenT f (L.List a)
listOf1 =
Expand Down Expand Up @@ -259,15 +261,17 @@ listOfLength i =

distinctListOf1
f a
. (Monad f, Eq a)
. Monad f
Eq a
Gen.GenT f a
Gen.GenT f (L.List a)
distinctListOf1 =
map (map L.nub) listOf1

distinctListOf
f a
. (Monad f, Eq a)
. Monad f
Eq a
Gen.GenT f a
Gen.GenT f (L.List a)
distinctListOf =
Expand Down Expand Up @@ -300,6 +304,12 @@ instance showExpr ∷ (Show a) ⇒ Show (Expr a) where
derive instance eqExprEq a Eq (Expr a)
derive instance ordExprOrd a Ord (Expr a)

instance eq1Eq1 Expr where
eq1 = eq

instance ord1ExprOrd1 Expr where
compare1 = compare

genExpr a. Gen.Gen a Gen.Gen (Expr a)
genExpr g = do
b ← SCA.arbitrary
Expand Down
4 changes: 2 additions & 2 deletions src/Text/Markdown/SlamDown/Syntax/TextBox.purs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ instance coarbitraryTextBox ∷ (Functor f, SCA.Coarbitrary (f String), SCA.Coar
Numeric d -> SCA.coarbitrary $ HN.toNumber <$> d
Date d -> SCA.coarbitrary (ADT.ArbDate <$> d)
Time prec d -> do
SCA.coarbitrary prec
_ ← SCA.coarbitrary prec
SCA.coarbitrary (ADT.ArbTime <$> d)
DateTime prec d -> do
SCA.coarbitrary prec
_ ← SCA.coarbitrary prec
SCA.coarbitrary (ADT.ArbDateTime <$> d)

eraseMillis DT.Time DT.Time
Expand Down
9 changes: 5 additions & 4 deletions src/Text/Markdown/SlamDown/Traverse.purs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Text.Markdown.SlamDown.Syntax as SD

everywhereM
m a
. (Monad m)
. Monad m
(SD.Block a m (SD.Block a))
(SD.Inline a m (SD.Inline a))
SD.SlamDownP a
Expand Down Expand Up @@ -54,7 +54,7 @@ everywhere b i =

everywhereTopDownM
m a
. (Monad m)
. Monad m
(SD.Block a m (SD.Block a))
(SD.Inline a m (SD.Inline a))
SD.SlamDownP a
Expand Down Expand Up @@ -91,7 +91,8 @@ everywhereTopDown b i =

everythingM
m a r
. (Monad m, Monoid r)
. Monad m
Monoid r
(SD.Block a m r)
(SD.Inline a m r)
SD.SlamDownP a
Expand All @@ -115,7 +116,7 @@ everythingM b i (SD.SlamDown bs) =

everything
r a
. (Monoid r)
. Monoid r
(SD.Block a r)
(SD.Inline a r)
SD.SlamDownP a
Expand Down
8 changes: 4 additions & 4 deletions test/src/Test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import Partial.Unsafe (unsafePartial)
type TestEffects e =
( consoleC.CONSOLE
, randomRand.RANDOM
, errExn.EXCEPTION
, exceptionExn.EXCEPTION
| e
)

Expand Down Expand Up @@ -304,7 +304,7 @@ generated = do
10 (Gen.GenState { size: 10, seed })
(SDPR.prettyPrintMd <<< runTestSlamDown <$> SCA.arbitrary)

TR.traverse C.log docs
_ ← TR.traverse C.log docs

SC.quickCheck' 100 \(TestSlamDown sd) →
let
Expand Down Expand Up @@ -343,7 +343,7 @@ three ∷ ∀ a. a → a → a → Array a
three a b c = [a, b, c]


blocks a. (SCA.Arbitrary a, SD.Value a) Gen.Gen (Array (SD.Block a))
blocks a. SCA.Arbitrary a SD.Value a Gen.Gen (Array (SD.Block a))
blocks =
Gen.oneOf (smallArrayOf block0)
[ A.singleton <$> bq
Expand Down Expand Up @@ -375,7 +375,7 @@ blocks =
<$> Gen.oneOf (SD.Bullet <$> (Gen.elements "-" $ L.fromFoldable ["+", "*"])) [ SD.Ordered <$> (Gen.elements ")" $ L.singleton ".")]
<*> (L.fromFoldable <$> tinyArrayOf (L.fromFoldable <$> (tinyArrayOf block0)))

inlines a. (SCA.Arbitrary a, SD.Value a) Gen.Gen (Array (SD.Inline a))
inlines a. SCA.Arbitrary a SD.Value a Gen.Gen (Array (SD.Inline a))
inlines =
Gen.oneOf inlines0
[ A.singleton <$> link
Expand Down

0 comments on commit fcc5c05

Please sign in to comment.