-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathPattern.purs
More file actions
33 lines (25 loc) · 986 Bytes
/
Pattern.purs
File metadata and controls
33 lines (25 loc) · 986 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
module Data.String.Pattern where
import Prelude
import Data.Newtype (class Newtype)
-- | A newtype used in cases where there is a string to be matched.
-- |
-- | ```purescript
-- | pursPattern = Pattern ".purs"
-- | --can be used like this:
-- | contains pursPattern "Test.purs"
-- | == true
-- | ```
-- |
newtype Pattern = Pattern String
derive newtype instance eqPattern :: Eq Pattern
derive newtype instance ordPattern :: Ord Pattern
derive instance newtypePattern :: Newtype Pattern _
instance showPattern :: Show Pattern where
show (Pattern s) = "(Pattern " <> show s <> ")"
-- | A newtype used in cases to specify a replacement for a pattern.
newtype Replacement = Replacement String
derive newtype instance eqReplacement :: Eq Replacement
derive newtype instance ordReplacement :: Ord Replacement
derive instance newtypeReplacement :: Newtype Replacement _
instance showReplacement :: Show Replacement where
show (Replacement s) = "(Replacement " <> show s <> ")"