Skip to content

Remove primes from foreign modules exports #121

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
Mar 14, 2020
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/Data/String/CodeUnits.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ exports._indexOf = function (just) {
};
};

exports["_indexOf'"] = function (just) {
exports._indexOfStartingAt = function (just) {
return function (nothing) {
return function (x) {
return function (startAt) {
Expand All @@ -78,7 +78,7 @@ exports._lastIndexOf = function (just) {
};
};

exports["_lastIndexOf'"] = function (just) {
exports._lastIndexOfStartingAt = function (just) {
return function (nothing) {
return function (x) {
return function (startAt) {
Expand Down
8 changes: 4 additions & 4 deletions src/Data/String/CodeUnits.purs
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ foreign import _indexOf
-- | ```
-- |
indexOf' :: Pattern -> Int -> String -> Maybe Int
indexOf' = _indexOf' Just Nothing
indexOf' = _indexOfStartingAt Just Nothing

foreign import _indexOf'
foreign import _indexOfStartingAt
:: (forall a. a -> Maybe a)
-> (forall a. Maybe a)
-> Pattern
Expand Down Expand Up @@ -228,9 +228,9 @@ foreign import _lastIndexOf
-- | ```
-- |
lastIndexOf' :: Pattern -> Int -> String -> Maybe Int
lastIndexOf' = _lastIndexOf' Just Nothing
lastIndexOf' = _lastIndexOfStartingAt Just Nothing

foreign import _lastIndexOf'
foreign import _lastIndexOfStartingAt
:: (forall a. a -> Maybe a)
-> (forall a. Maybe a)
-> Pattern
Expand Down
8 changes: 4 additions & 4 deletions src/Data/String/Regex.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"use strict";

exports["showRegex'"] = function (r) {
exports.showRegexImpl = function (r) {
return "" + r;
};

exports["regex'"] = function (left) {
exports.regexImpl = function (left) {
return function (right) {
return function (s1) {
return function (s2) {
Expand All @@ -22,7 +22,7 @@ exports.source = function (r) {
return r.source;
};

exports["flags'"] = function (r) {
exports.flagsImpl = function (r) {
return {
multiline: r.multiline,
ignoreCase: r.ignoreCase,
Expand Down Expand Up @@ -67,7 +67,7 @@ exports.replace = function (r) {
};
};

exports["replace'"] = function (r) {
exports.replaceBy = function (r) {
return function (f) {
return function (s2) {
return s2.replace(r, function (match) {
Expand Down
17 changes: 10 additions & 7 deletions src/Data/String/Regex.purs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ import Data.String.Regex.Flags (RegexFlags(..), RegexFlagsRec)
-- | Wraps Javascript `RegExp` objects.
foreign import data Regex :: Type

foreign import showRegex' :: Regex -> String
foreign import showRegexImpl :: Regex -> String

instance showRegex :: Show Regex where
show = showRegex'
show = showRegexImpl

foreign import regex'
foreign import regexImpl
:: (String -> Either String Regex)
-> (Regex -> Either String Regex)
-> String
Expand All @@ -43,17 +43,17 @@ foreign import regex'
-- | Constructs a `Regex` from a pattern string and flags. Fails with
-- | `Left error` if the pattern contains a syntax error.
regex :: String -> RegexFlags -> Either String Regex
regex s f = regex' Left Right s $ renderFlags f
regex s f = regexImpl Left Right s $ renderFlags f

-- | Returns the pattern string used to construct the given `Regex`.
foreign import source :: Regex -> String

-- | Returns the `RegexFlags` used to construct the given `Regex`.
flags :: Regex -> RegexFlags
flags = RegexFlags <<< flags'
flags = RegexFlags <<< flagsImpl

-- | Returns the `RegexFlags` inner record used to construct the given `Regex`.
foreign import flags' :: Regex -> RegexFlagsRec
foreign import flagsImpl :: Regex -> RegexFlagsRec

-- | Returns the string representation of the given `RegexFlags`.
renderFlags :: RegexFlags -> String
Expand Down Expand Up @@ -101,7 +101,10 @@ foreign import replace :: Regex -> String -> String -> String
-- | Transforms occurences of the `Regex` using a function of the matched
-- | substring and a list of submatch strings.
-- | See the [reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_function_as_a_parameter).
foreign import replace' :: Regex -> (String -> Array String -> String) -> String -> String
replace' :: Regex -> (String -> Array String -> String) -> String -> String
replace' = replaceBy

foreign import replaceBy :: Regex -> (String -> Array String -> String) -> String -> String

foreign import _search
:: (forall r. r -> Maybe r)
Expand Down