File tree 2 files changed +6
-9
lines changed
2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ Bugfixes:
15
15
16
16
Other improvements:
17
17
- Surround code with backticks in documentation (#148 )
18
+ - Make ` RegexFlags ` a ` newtype ` and a ` Newtype ` instance for it(#159 by @mhmdanas )
18
19
19
20
## [ v5.0.0] ( https://github.com/purescript/purescript-strings/releases/tag/v5.0.0 ) - 2021-02-26
20
21
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ module Data.String.Regex.Flags where
3
3
import Prelude
4
4
5
5
import Control.MonadPlus (guard )
6
+ import Data.Newtype (class Newtype )
6
7
import Data.String (joinWith )
7
8
8
9
type RegexFlagsRec =
@@ -15,7 +16,9 @@ type RegexFlagsRec =
15
16
}
16
17
17
18
-- | Flags that control matching.
18
- data RegexFlags = RegexFlags RegexFlagsRec
19
+ newtype RegexFlags = RegexFlags RegexFlagsRec
20
+
21
+ derive instance newtypeRegexFlags :: Newtype RegexFlags _
19
22
20
23
-- | All flags set to false.
21
24
noFlags :: RegexFlags
@@ -107,14 +110,7 @@ instance semigroupRegexFlags :: Semigroup RegexFlags where
107
110
instance monoidRegexFlags :: Monoid RegexFlags where
108
111
mempty = noFlags
109
112
110
- instance eqRegexFlags :: Eq RegexFlags where
111
- eq (RegexFlags x) (RegexFlags y)
112
- = x.global == y.global
113
- && x.ignoreCase == y.ignoreCase
114
- && x.multiline == y.multiline
115
- && x.dotAll == y.dotAll
116
- && x.sticky == y.sticky
117
- && x.unicode == y.unicode
113
+ derive newtype instance eqRegexFlags :: Eq RegexFlags
118
114
119
115
instance showRegexFlags :: Show RegexFlags where
120
116
show (RegexFlags flags) =
You can’t perform that action at this time.
0 commit comments