Skip to content

Replace monomorphic proxies by Type.Proxy.Proxy and polymorphic variables #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Data/String/NonEmpty/Internal.purs
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ import Data.Maybe (Maybe(..), fromJust)
import Data.Semigroup.Foldable (class Foldable1)
import Data.String as String
import Data.String.Pattern (Pattern)
import Data.Symbol (class IsSymbol, SProxy, reflectSymbol)
import Data.Symbol (class IsSymbol, reflectSymbol)
import Prim.TypeError as TE
import Unsafe.Coerce (unsafeCoerce)

@@ -26,10 +26,10 @@ instance showNonEmptyString :: Show NonEmptyString where
-- |
-- | ``` purescript
-- | something :: NonEmptyString
-- | something = nes (SProxy :: SProxy "something")
-- | something = nes (Proxy :: Proxy "something")
-- | ```
class MakeNonEmpty (s :: Symbol) where
nes :: SProxy s -> NonEmptyString
nes :: forall proxy. proxy s -> NonEmptyString

instance makeNonEmptyBad :: TE.Fail (TE.Text "Cannot create an NonEmptyString from an empty Symbol") => MakeNonEmpty "" where
nes _ = NonEmptyString ""
138 changes: 69 additions & 69 deletions test/Test/Data/String/NonEmpty.purs
Original file line number Diff line number Diff line change
@@ -6,11 +6,11 @@ import Data.Array.NonEmpty as NEA
import Data.Maybe (Maybe(..), fromJust)
import Data.String.NonEmpty (Pattern(..), nes)
import Data.String.NonEmpty as NES
import Data.Symbol (SProxy(..))
import Effect (Effect)
import Effect.Console (log)
import Partial.Unsafe (unsafePartial)
import Test.Assert (assert, assertEqual)
import Type.Proxy (Proxy(..))

testNonEmptyString :: Effect Unit
testNonEmptyString = do
@@ -22,7 +22,7 @@ testNonEmptyString = do
}
assertEqual
{ actual: NES.fromString "hello"
, expected: Just (nes (SProxy :: SProxy "hello"))
, expected: Just (nes (Proxy :: Proxy "hello"))
}

log "toString"
@@ -33,136 +33,136 @@ testNonEmptyString = do

log "appendString"
assertEqual
{ actual: NES.appendString (nes (SProxy :: SProxy "Hello")) " world"
, expected: nes (SProxy :: SProxy "Hello world")
{ actual: NES.appendString (nes (Proxy :: Proxy "Hello")) " world"
, expected: nes (Proxy :: Proxy "Hello world")
}
assertEqual
{ actual: NES.appendString (nes (SProxy :: SProxy "Hello")) ""
, expected: nes (SProxy :: SProxy "Hello")
{ actual: NES.appendString (nes (Proxy :: Proxy "Hello")) ""
, expected: nes (Proxy :: Proxy "Hello")
}

log "prependString"
assertEqual
{ actual: NES.prependString "be" (nes (SProxy :: SProxy "fore"))
, expected: nes (SProxy :: SProxy "before")
{ actual: NES.prependString "be" (nes (Proxy :: Proxy "fore"))
, expected: nes (Proxy :: Proxy "before")
}
assertEqual
{ actual: NES.prependString "" (nes (SProxy :: SProxy "fore"))
, expected: nes (SProxy :: SProxy "fore")
{ actual: NES.prependString "" (nes (Proxy :: Proxy "fore"))
, expected: nes (Proxy :: Proxy "fore")
}

log "contains"
assert $ NES.contains (Pattern "") (nes (SProxy :: SProxy "abcd"))
assert $ NES.contains (Pattern "bc") (nes (SProxy :: SProxy "abcd"))
assert $ not NES.contains (Pattern "cb") (nes (SProxy :: SProxy "abcd"))
assert $ NES.contains (Pattern "needle") (nes (SProxy :: SProxy "haystack with needle"))
assert $ not NES.contains (Pattern "needle") (nes (SProxy :: SProxy "haystack"))
assert $ NES.contains (Pattern "") (nes (Proxy :: Proxy "abcd"))
assert $ NES.contains (Pattern "bc") (nes (Proxy :: Proxy "abcd"))
assert $ not NES.contains (Pattern "cb") (nes (Proxy :: Proxy "abcd"))
assert $ NES.contains (Pattern "needle") (nes (Proxy :: Proxy "haystack with needle"))
assert $ not NES.contains (Pattern "needle") (nes (Proxy :: Proxy "haystack"))

log "localeCompare"
assertEqual
{ actual: NES.localeCompare (nes (SProxy :: SProxy "a")) (nes (SProxy :: SProxy "a"))
{ actual: NES.localeCompare (nes (Proxy :: Proxy "a")) (nes (Proxy :: Proxy "a"))
, expected: EQ
}
assertEqual
{ actual: NES.localeCompare (nes (SProxy :: SProxy "a")) (nes (SProxy :: SProxy "b"))
{ actual: NES.localeCompare (nes (Proxy :: Proxy "a")) (nes (Proxy :: Proxy "b"))
, expected: LT
}
assertEqual
{ actual: NES.localeCompare (nes (SProxy :: SProxy "b")) (nes (SProxy :: SProxy "a"))
{ actual: NES.localeCompare (nes (Proxy :: Proxy "b")) (nes (Proxy :: Proxy "a"))
, expected: GT
}

log "replace"
assertEqual
{ actual: NES.replace (Pattern "b") (NES.NonEmptyReplacement (nes (SProxy :: SProxy "!"))) (nes (SProxy :: SProxy "abc"))
, expected: nes (SProxy :: SProxy "a!c")
{ actual: NES.replace (Pattern "b") (NES.NonEmptyReplacement (nes (Proxy :: Proxy "!"))) (nes (Proxy :: Proxy "abc"))
, expected: nes (Proxy :: Proxy "a!c")
}
assertEqual
{ actual: NES.replace (Pattern "b") (NES.NonEmptyReplacement (nes (SProxy :: SProxy "!"))) (nes (SProxy :: SProxy "abbc"))
, expected: nes (SProxy :: SProxy "a!bc")
{ actual: NES.replace (Pattern "b") (NES.NonEmptyReplacement (nes (Proxy :: Proxy "!"))) (nes (Proxy :: Proxy "abbc"))
, expected: nes (Proxy :: Proxy "a!bc")
}
assertEqual
{ actual: NES.replace (Pattern "d") (NES.NonEmptyReplacement (nes (SProxy :: SProxy "!"))) (nes (SProxy :: SProxy "abc"))
, expected: nes (SProxy :: SProxy "abc")
{ actual: NES.replace (Pattern "d") (NES.NonEmptyReplacement (nes (Proxy :: Proxy "!"))) (nes (Proxy :: Proxy "abc"))
, expected: nes (Proxy :: Proxy "abc")
}

log "replaceAll"
assertEqual
{ actual: NES.replaceAll (Pattern "[b]") (NES.NonEmptyReplacement (nes (SProxy :: SProxy "!"))) (nes (SProxy :: SProxy "a[b]c"))
, expected: nes (SProxy :: SProxy "a!c")
{ actual: NES.replaceAll (Pattern "[b]") (NES.NonEmptyReplacement (nes (Proxy :: Proxy "!"))) (nes (Proxy :: Proxy "a[b]c"))
, expected: nes (Proxy :: Proxy "a!c")
}
assertEqual
{ actual: NES.replaceAll (Pattern "[b]") (NES.NonEmptyReplacement (nes (SProxy :: SProxy "!"))) (nes (SProxy :: SProxy "a[b]c[b]"))
, expected: nes (SProxy :: SProxy "a!c!")
{ actual: NES.replaceAll (Pattern "[b]") (NES.NonEmptyReplacement (nes (Proxy :: Proxy "!"))) (nes (Proxy :: Proxy "a[b]c[b]"))
, expected: nes (Proxy :: Proxy "a!c!")
}
assertEqual
{ actual: NES.replaceAll (Pattern "x") (NES.NonEmptyReplacement (nes (SProxy :: SProxy "!"))) (nes (SProxy :: SProxy "abc"))
, expected: nes (SProxy :: SProxy "abc")
{ actual: NES.replaceAll (Pattern "x") (NES.NonEmptyReplacement (nes (Proxy :: Proxy "!"))) (nes (Proxy :: Proxy "abc"))
, expected: nes (Proxy :: Proxy "abc")
}

log "stripPrefix"
assertEqual
{ actual: NES.stripPrefix (Pattern "") (nes (SProxy :: SProxy "abc"))
, expected: Just (nes (SProxy :: SProxy "abc"))
{ actual: NES.stripPrefix (Pattern "") (nes (Proxy :: Proxy "abc"))
, expected: Just (nes (Proxy :: Proxy "abc"))
}
assertEqual
{ actual: NES.stripPrefix (Pattern "a") (nes (SProxy :: SProxy "abc"))
, expected: Just (nes (SProxy :: SProxy "bc"))
{ actual: NES.stripPrefix (Pattern "a") (nes (Proxy :: Proxy "abc"))
, expected: Just (nes (Proxy :: Proxy "bc"))
}
assertEqual
{ actual: NES.stripPrefix (Pattern "abc") (nes (SProxy :: SProxy "abc"))
{ actual: NES.stripPrefix (Pattern "abc") (nes (Proxy :: Proxy "abc"))
, expected: Nothing
}
assertEqual
{ actual: NES.stripPrefix (Pattern "!") (nes (SProxy :: SProxy "abc"))
{ actual: NES.stripPrefix (Pattern "!") (nes (Proxy :: Proxy "abc"))
, expected: Nothing
}
assertEqual
{ actual: NES.stripPrefix (Pattern "http:") (nes (SProxy :: SProxy "http://purescript.org"))
, expected: Just (nes (SProxy :: SProxy "//purescript.org"))
{ actual: NES.stripPrefix (Pattern "http:") (nes (Proxy :: Proxy "http://purescript.org"))
, expected: Just (nes (Proxy :: Proxy "//purescript.org"))
}
assertEqual
{ actual: NES.stripPrefix (Pattern "http:") (nes (SProxy :: SProxy "https://purescript.org"))
{ actual: NES.stripPrefix (Pattern "http:") (nes (Proxy :: Proxy "https://purescript.org"))
, expected: Nothing
}
assertEqual
{ actual: NES.stripPrefix (Pattern "Hello!") (nes (SProxy :: SProxy "Hello!"))
{ actual: NES.stripPrefix (Pattern "Hello!") (nes (Proxy :: Proxy "Hello!"))
, expected: Nothing
}

log "stripSuffix"
assertEqual
{ actual: NES.stripSuffix (Pattern ".exe") (nes (SProxy :: SProxy "purs.exe"))
, expected: Just (nes (SProxy :: SProxy "purs"))
{ actual: NES.stripSuffix (Pattern ".exe") (nes (Proxy :: Proxy "purs.exe"))
, expected: Just (nes (Proxy :: Proxy "purs"))
}
assertEqual
{ actual: NES.stripSuffix (Pattern ".exe") (nes (SProxy :: SProxy "purs"))
{ actual: NES.stripSuffix (Pattern ".exe") (nes (Proxy :: Proxy "purs"))
, expected: Nothing
}
assertEqual
{ actual: NES.stripSuffix (Pattern "Hello!") (nes (SProxy :: SProxy "Hello!"))
{ actual: NES.stripSuffix (Pattern "Hello!") (nes (Proxy :: Proxy "Hello!"))
, expected: Nothing
}

log "toLower"
assertEqual
{ actual: NES.toLower (nes (SProxy :: SProxy "bAtMaN"))
, expected: nes (SProxy :: SProxy "batman")
{ actual: NES.toLower (nes (Proxy :: Proxy "bAtMaN"))
, expected: nes (Proxy :: Proxy "batman")
}

log "toUpper"
assertEqual
{ actual: NES.toUpper (nes (SProxy :: SProxy "bAtMaN"))
, expected: nes (SProxy :: SProxy "BATMAN")
{ actual: NES.toUpper (nes (Proxy :: Proxy "bAtMaN"))
, expected: nes (Proxy :: Proxy "BATMAN")
}

log "trim"
assertEqual
{ actual: NES.trim (nes (SProxy :: SProxy " abc "))
, expected: Just (nes (SProxy :: SProxy "abc"))
{ actual: NES.trim (nes (Proxy :: Proxy " abc "))
, expected: Just (nes (Proxy :: Proxy "abc"))
}
assertEqual
{ actual: NES.trim (nes (SProxy :: SProxy " \n"))
{ actual: NES.trim (nes (Proxy :: Proxy " \n"))
, expected: Nothing
}

@@ -172,48 +172,48 @@ testNonEmptyString = do
, expected: ""
}
assertEqual
{ actual: NES.joinWith "" [nes (SProxy :: SProxy "a"), nes (SProxy :: SProxy "b")]
{ actual: NES.joinWith "" [nes (Proxy :: Proxy "a"), nes (Proxy :: Proxy "b")]
, expected: "ab"
}
assertEqual
{ actual: NES.joinWith "--" [nes (SProxy :: SProxy "a"), nes (SProxy :: SProxy "b"), nes (SProxy :: SProxy "c")]
{ actual: NES.joinWith "--" [nes (Proxy :: Proxy "a"), nes (Proxy :: Proxy "b"), nes (Proxy :: Proxy "c")]
, expected: "a--b--c"
}

log "join1With"
assertEqual
{ actual: NES.join1With "" (nea [nes (SProxy :: SProxy "a"), nes (SProxy :: SProxy "b")])
, expected: nes (SProxy :: SProxy "ab")
{ actual: NES.join1With "" (nea [nes (Proxy :: Proxy "a"), nes (Proxy :: Proxy "b")])
, expected: nes (Proxy :: Proxy "ab")
}
assertEqual
{ actual: NES.join1With "--" (nea [nes (SProxy :: SProxy "a"), nes (SProxy :: SProxy "b"), nes (SProxy :: SProxy "c")])
, expected: nes (SProxy :: SProxy "a--b--c")
{ actual: NES.join1With "--" (nea [nes (Proxy :: Proxy "a"), nes (Proxy :: Proxy "b"), nes (Proxy :: Proxy "c")])
, expected: nes (Proxy :: Proxy "a--b--c")
}
assertEqual
{ actual: NES.join1With ", " (nea [nes (SProxy :: SProxy "apple"), nes (SProxy :: SProxy "banana")])
, expected: nes (SProxy :: SProxy "apple, banana")
{ actual: NES.join1With ", " (nea [nes (Proxy :: Proxy "apple"), nes (Proxy :: Proxy "banana")])
, expected: nes (Proxy :: Proxy "apple, banana")
}
assertEqual
{ actual: NES.join1With "" (nea [nes (SProxy :: SProxy "apple"), nes (SProxy :: SProxy "banana")])
, expected: nes (SProxy :: SProxy "applebanana")
{ actual: NES.join1With "" (nea [nes (Proxy :: Proxy "apple"), nes (Proxy :: Proxy "banana")])
, expected: nes (Proxy :: Proxy "applebanana")
}

log "joinWith1"
assertEqual
{ actual: NES.joinWith1 (nes (SProxy :: SProxy " ")) (nea ["a", "b"])
, expected: nes (SProxy :: SProxy "a b")
{ actual: NES.joinWith1 (nes (Proxy :: Proxy " ")) (nea ["a", "b"])
, expected: nes (Proxy :: Proxy "a b")
}
assertEqual
{ actual: NES.joinWith1 (nes (SProxy :: SProxy "--")) (nea ["a", "b", "c"])
, expected: nes (SProxy :: SProxy "a--b--c")
{ actual: NES.joinWith1 (nes (Proxy :: Proxy "--")) (nea ["a", "b", "c"])
, expected: nes (Proxy :: Proxy "a--b--c")
}
assertEqual
{ actual: NES.joinWith1 (nes (SProxy :: SProxy ", ")) (nea ["apple", "banana"])
, expected: nes (SProxy :: SProxy "apple, banana")
{ actual: NES.joinWith1 (nes (Proxy :: Proxy ", ")) (nea ["apple", "banana"])
, expected: nes (Proxy :: Proxy "apple, banana")
}
assertEqual
{ actual: NES.joinWith1 (nes (SProxy :: SProxy "/")) (nea ["a", "b", "", "c", ""])
, expected: nes (SProxy :: SProxy "a/b//c/")
{ actual: NES.joinWith1 (nes (Proxy :: Proxy "/")) (nea ["a", "b", "", "c", ""])
, expected: nes (Proxy :: Proxy "a/b//c/")
}

nea :: Array ~> NEA.NonEmptyArray
234 changes: 117 additions & 117 deletions test/Test/Data/String/NonEmpty/CodeUnits.purs
Original file line number Diff line number Diff line change
@@ -7,11 +7,11 @@ import Data.Enum (fromEnum)
import Data.Maybe (Maybe(..), fromJust)
import Data.String.NonEmpty (Pattern(..), nes)
import Data.String.NonEmpty.CodeUnits as NESCU
import Data.Symbol (SProxy(..))
import Effect (Effect)
import Effect.Console (log)
import Partial.Unsafe (unsafePartial)
import Test.Assert (assertEqual)
import Type.Proxy (Proxy(..))

testNonEmptyStringCodeUnits :: Effect Unit
testNonEmptyStringCodeUnits = do
@@ -23,7 +23,7 @@ testNonEmptyStringCodeUnits = do
}
assertEqual
{ actual: NESCU.fromCharArray ['a', 'b']
, expected: Just (nes (SProxy :: SProxy "ab"))
, expected: Just (nes (Proxy :: Proxy "ab"))
}

log "fromNonEmptyCharArray"
@@ -35,415 +35,415 @@ testNonEmptyStringCodeUnits = do
log "singleton"
assertEqual
{ actual: NESCU.singleton 'a'
, expected: nes (SProxy :: SProxy "a")
, expected: nes (Proxy :: Proxy "a")
}

log "cons"
assertEqual
{ actual: NESCU.cons 'a' "bc"
, expected: nes (SProxy :: SProxy "abc")
, expected: nes (Proxy :: Proxy "abc")
}
assertEqual
{ actual: NESCU.cons 'a' ""
, expected: nes (SProxy :: SProxy "a")
, expected: nes (Proxy :: Proxy "a")
}

log "snoc"
assertEqual
{ actual: NESCU.snoc 'c' "ab"
, expected: nes (SProxy :: SProxy "abc")
, expected: nes (Proxy :: Proxy "abc")
}
assertEqual
{ actual: NESCU.snoc 'a' ""
, expected: nes (SProxy :: SProxy "a")
, expected: nes (Proxy :: Proxy "a")
}

log "fromFoldable1"
assertEqual
{ actual: NESCU.fromFoldable1 (nea ['a'])
, expected: nes (SProxy :: SProxy "a")
, expected: nes (Proxy :: Proxy "a")
}
assertEqual
{ actual: NESCU.fromFoldable1 (nea ['a', 'b', 'c'])
, expected: nes (SProxy :: SProxy "abc")
, expected: nes (Proxy :: Proxy "abc")
}

log "charAt"
assertEqual
{ actual: NESCU.charAt 0 (nes (SProxy :: SProxy "a"))
{ actual: NESCU.charAt 0 (nes (Proxy :: Proxy "a"))
, expected: Just 'a'
}
assertEqual
{ actual: NESCU.charAt 1 (nes (SProxy :: SProxy "a"))
{ actual: NESCU.charAt 1 (nes (Proxy :: Proxy "a"))
, expected: Nothing
}
assertEqual
{ actual: NESCU.charAt 0 (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.charAt 0 (nes (Proxy :: Proxy "ab"))
, expected: Just 'a'
}
assertEqual
{ actual: NESCU.charAt 1 (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.charAt 1 (nes (Proxy :: Proxy "ab"))
, expected: Just 'b'
}
assertEqual
{ actual: NESCU.charAt 2 (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.charAt 2 (nes (Proxy :: Proxy "ab"))
, expected: Nothing
}
assertEqual
{ actual: NESCU.charAt 2 (nes (SProxy :: SProxy "Hello"))
{ actual: NESCU.charAt 2 (nes (Proxy :: Proxy "Hello"))
, expected: Just 'l'
}
assertEqual
{ actual: NESCU.charAt 10 (nes (SProxy :: SProxy "Hello"))
{ actual: NESCU.charAt 10 (nes (Proxy :: Proxy "Hello"))
, expected: Nothing
}

log "charCodeAt"
assertEqual
{ actual: fromEnum <$> NESCU.charAt 0 (nes (SProxy :: SProxy "a"))
{ actual: fromEnum <$> NESCU.charAt 0 (nes (Proxy :: Proxy "a"))
, expected: Just 97
}
assertEqual
{ actual: fromEnum <$> NESCU.charAt 1 (nes (SProxy :: SProxy "a"))
{ actual: fromEnum <$> NESCU.charAt 1 (nes (Proxy :: Proxy "a"))
, expected: Nothing
}
assertEqual
{ actual: fromEnum <$> NESCU.charAt 0 (nes (SProxy :: SProxy "ab"))
{ actual: fromEnum <$> NESCU.charAt 0 (nes (Proxy :: Proxy "ab"))
, expected: Just 97
}
assertEqual
{ actual: fromEnum <$> NESCU.charAt 1 (nes (SProxy :: SProxy "ab"))
{ actual: fromEnum <$> NESCU.charAt 1 (nes (Proxy :: Proxy "ab"))
, expected: Just 98
}
assertEqual
{ actual: fromEnum <$> NESCU.charAt 2 (nes (SProxy :: SProxy "ab"))
{ actual: fromEnum <$> NESCU.charAt 2 (nes (Proxy :: Proxy "ab"))
, expected: Nothing
}
assertEqual
{ actual: fromEnum <$> NESCU.charAt 2 (nes (SProxy :: SProxy "5 €"))
{ actual: fromEnum <$> NESCU.charAt 2 (nes (Proxy :: Proxy "5 €"))
, expected: Just 0x20AC
}
assertEqual
{ actual: fromEnum <$> NESCU.charAt 10 (nes (SProxy :: SProxy "5 €"))
{ actual: fromEnum <$> NESCU.charAt 10 (nes (Proxy :: Proxy "5 €"))
, expected: Nothing
}

log "toChar"
assertEqual
{ actual: NESCU.toChar (nes (SProxy :: SProxy "a"))
{ actual: NESCU.toChar (nes (Proxy :: Proxy "a"))
, expected: Just 'a'
}
assertEqual
{ actual: NESCU.toChar (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.toChar (nes (Proxy :: Proxy "ab"))
, expected: Nothing
}

log "toCharArray"
assertEqual
{ actual: NESCU.toCharArray (nes (SProxy :: SProxy "a"))
{ actual: NESCU.toCharArray (nes (Proxy :: Proxy "a"))
, expected: ['a']
}
assertEqual
{ actual: NESCU.toCharArray (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.toCharArray (nes (Proxy :: Proxy "ab"))
, expected: ['a', 'b']
}
assertEqual
{ actual: NESCU.toCharArray (nes (SProxy :: SProxy "Hello☺\n"))
{ actual: NESCU.toCharArray (nes (Proxy :: Proxy "Hello☺\n"))
, expected: ['H','e','l','l','o','☺','\n']
}

log "toNonEmptyCharArray"
assertEqual
{ actual: NESCU.toNonEmptyCharArray (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.toNonEmptyCharArray (nes (Proxy :: Proxy "ab"))
, expected: nea ['a', 'b']
}

log "uncons"
assertEqual
{ actual: NESCU.uncons (nes (SProxy :: SProxy "a"))
{ actual: NESCU.uncons (nes (Proxy :: Proxy "a"))
, expected: { head: 'a', tail: Nothing }
}
assertEqual
{ actual: NESCU.uncons (nes (SProxy :: SProxy "Hello World"))
, expected: { head: 'H', tail: Just (nes (SProxy :: SProxy "ello World")) }
{ actual: NESCU.uncons (nes (Proxy :: Proxy "Hello World"))
, expected: { head: 'H', tail: Just (nes (Proxy :: Proxy "ello World")) }
}

log "takeWhile"
assertEqual
{ actual: NESCU.takeWhile (\c -> true) (nes (SProxy :: SProxy "abc"))
, expected: Just (nes (SProxy :: SProxy "abc"))
{ actual: NESCU.takeWhile (\c -> true) (nes (Proxy :: Proxy "abc"))
, expected: Just (nes (Proxy :: Proxy "abc"))
}
assertEqual
{ actual: NESCU.takeWhile (\c -> false) (nes (SProxy :: SProxy "abc"))
{ actual: NESCU.takeWhile (\c -> false) (nes (Proxy :: Proxy "abc"))
, expected: Nothing
}
assertEqual
{ actual: NESCU.takeWhile (\c -> c /= 'b') (nes (SProxy :: SProxy "aabbcc"))
, expected: Just (nes (SProxy :: SProxy "aa"))
{ actual: NESCU.takeWhile (\c -> c /= 'b') (nes (Proxy :: Proxy "aabbcc"))
, expected: Just (nes (Proxy :: Proxy "aa"))
}
assertEqual
{ actual: NESCU.takeWhile (_ /= ':') (nes (SProxy :: SProxy "http://purescript.org"))
, expected: Just (nes (SProxy :: SProxy "http"))
{ actual: NESCU.takeWhile (_ /= ':') (nes (Proxy :: Proxy "http://purescript.org"))
, expected: Just (nes (Proxy :: Proxy "http"))
}
assertEqual
{ actual: NESCU.takeWhile (_ == 'a') (nes (SProxy :: SProxy "xyz"))
{ actual: NESCU.takeWhile (_ == 'a') (nes (Proxy :: Proxy "xyz"))
, expected: Nothing
}

log "dropWhile"
assertEqual
{ actual: NESCU.dropWhile (\c -> true) (nes (SProxy :: SProxy "abc"))
{ actual: NESCU.dropWhile (\c -> true) (nes (Proxy :: Proxy "abc"))
, expected: Nothing
}
assertEqual
{ actual: NESCU.dropWhile (\c -> false) (nes (SProxy :: SProxy "abc"))
, expected: Just (nes (SProxy :: SProxy "abc"))
{ actual: NESCU.dropWhile (\c -> false) (nes (Proxy :: Proxy "abc"))
, expected: Just (nes (Proxy :: Proxy "abc"))
}
assertEqual
{ actual: NESCU.dropWhile (\c -> c /= 'b') (nes (SProxy :: SProxy "aabbcc"))
, expected: Just (nes (SProxy :: SProxy "bbcc"))
{ actual: NESCU.dropWhile (\c -> c /= 'b') (nes (Proxy :: Proxy "aabbcc"))
, expected: Just (nes (Proxy :: Proxy "bbcc"))
}
assertEqual
{ actual: NESCU.dropWhile (_ /= '.') (nes (SProxy :: SProxy "Test.purs"))
, expected: Just (nes (SProxy :: SProxy ".purs"))
{ actual: NESCU.dropWhile (_ /= '.') (nes (Proxy :: Proxy "Test.purs"))
, expected: Just (nes (Proxy :: Proxy ".purs"))
}

log "indexOf"
assertEqual
{ actual: NESCU.indexOf (Pattern "") (nes (SProxy :: SProxy "abcd"))
{ actual: NESCU.indexOf (Pattern "") (nes (Proxy :: Proxy "abcd"))
, expected: Just 0
}
assertEqual
{ actual: NESCU.indexOf (Pattern "bc") (nes (SProxy :: SProxy "abcd"))
{ actual: NESCU.indexOf (Pattern "bc") (nes (Proxy :: Proxy "abcd"))
, expected: Just 1
}
assertEqual
{ actual: NESCU.indexOf (Pattern "cb") (nes (SProxy :: SProxy "abcd"))
{ actual: NESCU.indexOf (Pattern "cb") (nes (Proxy :: Proxy "abcd"))
, expected: Nothing
}

log "indexOf'"
assertEqual
{ actual: NESCU.indexOf' (Pattern "") (-1) (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.indexOf' (Pattern "") (-1) (nes (Proxy :: Proxy "ab"))
, expected: Nothing
}
assertEqual
{ actual: NESCU.indexOf' (Pattern "") 0 (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.indexOf' (Pattern "") 0 (nes (Proxy :: Proxy "ab"))
, expected: Just 0
}
assertEqual
{ actual: NESCU.indexOf' (Pattern "") 1 (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.indexOf' (Pattern "") 1 (nes (Proxy :: Proxy "ab"))
, expected: Just 1
}
assertEqual
{ actual: NESCU.indexOf' (Pattern "") 2 (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.indexOf' (Pattern "") 2 (nes (Proxy :: Proxy "ab"))
, expected: Just 2
}
assertEqual
{ actual: NESCU.indexOf' (Pattern "") 3 (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.indexOf' (Pattern "") 3 (nes (Proxy :: Proxy "ab"))
, expected: Nothing
}
assertEqual
{ actual: NESCU.indexOf' (Pattern "bc") 0 (nes (SProxy :: SProxy "abcd"))
{ actual: NESCU.indexOf' (Pattern "bc") 0 (nes (Proxy :: Proxy "abcd"))
, expected: Just 1
}
assertEqual
{ actual: NESCU.indexOf' (Pattern "bc") 1 (nes (SProxy :: SProxy "abcd"))
{ actual: NESCU.indexOf' (Pattern "bc") 1 (nes (Proxy :: Proxy "abcd"))
, expected: Just 1
}
assertEqual
{ actual: NESCU.indexOf' (Pattern "bc") 2 (nes (SProxy :: SProxy "abcd"))
{ actual: NESCU.indexOf' (Pattern "bc") 2 (nes (Proxy :: Proxy "abcd"))
, expected: Nothing
}
assertEqual
{ actual: NESCU.indexOf' (Pattern "cb") 0 (nes (SProxy :: SProxy "abcd"))
{ actual: NESCU.indexOf' (Pattern "cb") 0 (nes (Proxy :: Proxy "abcd"))
, expected: Nothing
}

log "lastIndexOf"
assertEqual
{ actual: NESCU.lastIndexOf (Pattern "") (nes (SProxy :: SProxy "abcd"))
{ actual: NESCU.lastIndexOf (Pattern "") (nes (Proxy :: Proxy "abcd"))
, expected: Just 4
}
assertEqual
{ actual: NESCU.lastIndexOf (Pattern "bc") (nes (SProxy :: SProxy "abcd"))
{ actual: NESCU.lastIndexOf (Pattern "bc") (nes (Proxy :: Proxy "abcd"))
, expected: Just 1
}
assertEqual
{ actual: NESCU.lastIndexOf (Pattern "cb") (nes (SProxy :: SProxy "abcd"))
{ actual: NESCU.lastIndexOf (Pattern "cb") (nes (Proxy :: Proxy "abcd"))
, expected: Nothing
}

log "lastIndexOf'"
assertEqual
{ actual: NESCU.lastIndexOf' (Pattern "") (-1) (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.lastIndexOf' (Pattern "") (-1) (nes (Proxy :: Proxy "ab"))
, expected: Nothing
}
assertEqual
{ actual: NESCU.lastIndexOf' (Pattern "") 0 (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.lastIndexOf' (Pattern "") 0 (nes (Proxy :: Proxy "ab"))
, expected: Just 0
}
assertEqual
{ actual: NESCU.lastIndexOf' (Pattern "") 1 (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.lastIndexOf' (Pattern "") 1 (nes (Proxy :: Proxy "ab"))
, expected: Just 1
}
assertEqual
{ actual: NESCU.lastIndexOf' (Pattern "") 2 (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.lastIndexOf' (Pattern "") 2 (nes (Proxy :: Proxy "ab"))
, expected: Just 2
}
assertEqual
{ actual: NESCU.lastIndexOf' (Pattern "") 3 (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.lastIndexOf' (Pattern "") 3 (nes (Proxy :: Proxy "ab"))
, expected: Nothing
}
assertEqual
{ actual: NESCU.lastIndexOf' (Pattern "bc") 0 (nes (SProxy :: SProxy "abcd"))
{ actual: NESCU.lastIndexOf' (Pattern "bc") 0 (nes (Proxy :: Proxy "abcd"))
, expected: Nothing
}
assertEqual
{ actual: NESCU.lastIndexOf' (Pattern "bc") 1 (nes (SProxy :: SProxy "abcd"))
{ actual: NESCU.lastIndexOf' (Pattern "bc") 1 (nes (Proxy :: Proxy "abcd"))
, expected: Just 1
}
assertEqual
{ actual: NESCU.lastIndexOf' (Pattern "bc") 2 (nes (SProxy :: SProxy "abcd"))
{ actual: NESCU.lastIndexOf' (Pattern "bc") 2 (nes (Proxy :: Proxy "abcd"))
, expected: Just 1
}
assertEqual
{ actual: NESCU.lastIndexOf' (Pattern "cb") 0 (nes (SProxy :: SProxy "abcd"))
{ actual: NESCU.lastIndexOf' (Pattern "cb") 0 (nes (Proxy :: Proxy "abcd"))
, expected: Nothing
}

log "length"
assertEqual
{ actual: NESCU.length (nes (SProxy :: SProxy "a"))
{ actual: NESCU.length (nes (Proxy :: Proxy "a"))
, expected: 1
}
assertEqual
{ actual: NESCU.length (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.length (nes (Proxy :: Proxy "ab"))
, expected: 2
}

log "take"
assertEqual
{ actual: NESCU.take 0 (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.take 0 (nes (Proxy :: Proxy "ab"))
, expected: Nothing
}
assertEqual
{ actual: NESCU.take 1 (nes (SProxy :: SProxy "ab"))
, expected: Just (nes (SProxy :: SProxy "a"))
{ actual: NESCU.take 1 (nes (Proxy :: Proxy "ab"))
, expected: Just (nes (Proxy :: Proxy "a"))
}
assertEqual
{ actual: NESCU.take 2 (nes (SProxy :: SProxy "ab"))
, expected: Just (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.take 2 (nes (Proxy :: Proxy "ab"))
, expected: Just (nes (Proxy :: Proxy "ab"))
}
assertEqual
{ actual: NESCU.take 3 (nes (SProxy :: SProxy "ab"))
, expected: Just (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.take 3 (nes (Proxy :: Proxy "ab"))
, expected: Just (nes (Proxy :: Proxy "ab"))
}
assertEqual
{ actual: NESCU.take (-1) (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.take (-1) (nes (Proxy :: Proxy "ab"))
, expected: Nothing
}

log "takeRight"
assertEqual
{ actual: NESCU.takeRight 0 (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.takeRight 0 (nes (Proxy :: Proxy "ab"))
, expected: Nothing
}
assertEqual
{ actual: NESCU.takeRight 1 (nes (SProxy :: SProxy "ab"))
, expected: Just (nes (SProxy :: SProxy "b"))
{ actual: NESCU.takeRight 1 (nes (Proxy :: Proxy "ab"))
, expected: Just (nes (Proxy :: Proxy "b"))
}
assertEqual
{ actual: NESCU.takeRight 2 (nes (SProxy :: SProxy "ab"))
, expected: Just (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.takeRight 2 (nes (Proxy :: Proxy "ab"))
, expected: Just (nes (Proxy :: Proxy "ab"))
}
assertEqual
{ actual: NESCU.takeRight 3 (nes (SProxy :: SProxy "ab"))
, expected: Just (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.takeRight 3 (nes (Proxy :: Proxy "ab"))
, expected: Just (nes (Proxy :: Proxy "ab"))
}
assertEqual
{ actual: NESCU.takeRight (-1) (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.takeRight (-1) (nes (Proxy :: Proxy "ab"))
, expected: Nothing
}

log "drop"
assertEqual
{ actual: NESCU.drop 0 (nes (SProxy :: SProxy "ab"))
, expected: Just (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.drop 0 (nes (Proxy :: Proxy "ab"))
, expected: Just (nes (Proxy :: Proxy "ab"))
}
assertEqual
{ actual: NESCU.drop 1 (nes (SProxy :: SProxy "ab"))
, expected: Just (nes (SProxy :: SProxy "b"))
{ actual: NESCU.drop 1 (nes (Proxy :: Proxy "ab"))
, expected: Just (nes (Proxy :: Proxy "b"))
}
assertEqual
{ actual: NESCU.drop 2 (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.drop 2 (nes (Proxy :: Proxy "ab"))
, expected: Nothing
}
assertEqual
{ actual: NESCU.drop 3 (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.drop 3 (nes (Proxy :: Proxy "ab"))
, expected: Nothing
}
assertEqual
{ actual: NESCU.drop (-1) (nes (SProxy :: SProxy "ab"))
, expected: Just (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.drop (-1) (nes (Proxy :: Proxy "ab"))
, expected: Just (nes (Proxy :: Proxy "ab"))
}

log "dropRight"
assertEqual
{ actual: NESCU.dropRight 0 (nes (SProxy :: SProxy "ab"))
, expected: Just (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.dropRight 0 (nes (Proxy :: Proxy "ab"))
, expected: Just (nes (Proxy :: Proxy "ab"))
}
assertEqual
{ actual: NESCU.dropRight 1 (nes (SProxy :: SProxy "ab"))
, expected: Just (nes (SProxy :: SProxy "a"))
{ actual: NESCU.dropRight 1 (nes (Proxy :: Proxy "ab"))
, expected: Just (nes (Proxy :: Proxy "a"))
}
assertEqual
{ actual: NESCU.dropRight 2 (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.dropRight 2 (nes (Proxy :: Proxy "ab"))
, expected: Nothing
}
assertEqual
{ actual: NESCU.dropRight 3 (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.dropRight 3 (nes (Proxy :: Proxy "ab"))
, expected: Nothing
}
assertEqual
{ actual: NESCU.dropRight (-1) (nes (SProxy :: SProxy "ab"))
, expected: Just (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.dropRight (-1) (nes (Proxy :: Proxy "ab"))
, expected: Just (nes (Proxy :: Proxy "ab"))
}

log "countPrefix"
assertEqual
{ actual: NESCU.countPrefix (_ == 'a') (nes (SProxy :: SProxy "ab"))
{ actual: NESCU.countPrefix (_ == 'a') (nes (Proxy :: Proxy "ab"))
, expected: 1
}
assertEqual
{ actual: NESCU.countPrefix (_ == 'a') (nes (SProxy :: SProxy "aaab"))
{ actual: NESCU.countPrefix (_ == 'a') (nes (Proxy :: Proxy "aaab"))
, expected: 3
}
assertEqual
{ actual: NESCU.countPrefix (_ == 'a') (nes (SProxy :: SProxy "abaa"))
{ actual: NESCU.countPrefix (_ == 'a') (nes (Proxy :: Proxy "abaa"))
, expected: 1
}
assertEqual
{ actual: NESCU.countPrefix (_ == 'c') (nes (SProxy :: SProxy "abaa"))
{ actual: NESCU.countPrefix (_ == 'c') (nes (Proxy :: Proxy "abaa"))
, expected: 0
}

log "splitAt"
assertEqual
{ actual: NESCU.splitAt 0 (nes (SProxy :: SProxy "a"))
, expected: { before: Nothing, after: Just (nes (SProxy :: SProxy "a")) }
{ actual: NESCU.splitAt 0 (nes (Proxy :: Proxy "a"))
, expected: { before: Nothing, after: Just (nes (Proxy :: Proxy "a")) }
}
assertEqual
{ actual: NESCU.splitAt 1 (nes (SProxy :: SProxy "ab"))
, expected: { before: Just (nes (SProxy :: SProxy "a")), after: Just (nes (SProxy :: SProxy "b")) }
{ actual: NESCU.splitAt 1 (nes (Proxy :: Proxy "ab"))
, expected: { before: Just (nes (Proxy :: Proxy "a")), after: Just (nes (Proxy :: Proxy "b")) }
}
assertEqual
{ actual: NESCU.splitAt 3 (nes (SProxy :: SProxy "aabcc"))
, expected: { before: Just (nes (SProxy :: SProxy "aab")), after: Just (nes (SProxy :: SProxy "cc")) }
{ actual: NESCU.splitAt 3 (nes (Proxy :: Proxy "aabcc"))
, expected: { before: Just (nes (Proxy :: Proxy "aab")), after: Just (nes (Proxy :: Proxy "cc")) }
}
assertEqual
{ actual: NESCU.splitAt (-1) (nes (SProxy :: SProxy "abc"))
, expected: { before: Nothing, after: Just (nes (SProxy :: SProxy "abc")) }
{ actual: NESCU.splitAt (-1) (nes (Proxy :: Proxy "abc"))
, expected: { before: Nothing, after: Just (nes (Proxy :: Proxy "abc")) }
}

nea :: Array ~> NEA.NonEmptyArray