Skip to content

Commit 37fadf1

Browse files
committed
Merge pull request #4 from michaelficarra/show
make Regex an instance of Show
2 parents ab511db + 48bcfe5 commit 37fadf1

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@
4646
data Regex :: *
4747

4848

49+
### Type Class Instances
50+
51+
instance showRegex :: Show Regex
52+
53+
4954
### Values
5055

5156
match :: Regex -> String -> [String]

src/Data/String/Regex.purs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
1-
module Data.String.Regex where
1+
module Data.String.Regex (
2+
Regex(..),
3+
regex,
4+
test,
5+
match,
6+
replace,
7+
replace',
8+
search
9+
) where
210

311
foreign import data Regex :: *
412

13+
foreign import showRegex'
14+
"function showRegex$prime(r){\
15+
\ return '' + r;\
16+
\}" :: Regex -> String
17+
18+
instance showRegex :: Show Regex where
19+
show = showRegex'
20+
521
foreign import regex
622
"function regex(s1) {\
723
\ return function(s2) {\

0 commit comments

Comments
 (0)