fay-base 0.19 → 0.19.1
raw patch · 3 files changed
+62/−3 lines, 3 filesdep ~fay
Dependency ranges changed: fay
Files
- CHANGELOG.md +4/−0
- fay-base.cabal +5/−3
- src/Data/Char.hs +53/−0
CHANGELOG.md view
@@ -1,5 +1,9 @@ ## Changelog +### 0.19.1 (2014-03-13)++* Add Data.Char+ ## 0.19 (2014-01-14) * Ord instance for Integer
fay-base.cabal view
@@ -1,5 +1,5 @@ name: fay-base-version: 0.19+version: 0.19.1 synopsis: The base package for Fay. description: The base package for Fay. This package amongst others exports Prelude and FFI which you probably want to use with Fay.@@ -21,19 +21,21 @@ src/Prelude.hs src/FFI.hs src/Data/Data.hs+ src/Data/Char.hs src/Data/Ratio.hs src/Debug/Trace.hs source-repository head type: git- location: https://github.com/faylang/fay.git+ location: https://github.com/faylang/fay-base.git library hs-source-dirs: src exposed: False exposed-modules: Prelude ,FFI+ ,Data.Char ,Data.Data ,Data.Ratio ,Debug.Trace- build-depends: base == 4.*, fay >= 0.19 && < 0.20+ build-depends: base == 4.*, fay >= 0.19.1 && < 0.20
+ src/Data/Char.hs view
@@ -0,0 +1,53 @@+module Data.Char+ (chr+ ,ord+ ,isAscii+ ,isLatin1+ ,toUpper+ ,toLower+ ,isAsciiLower+ ,isAsciiUpper+ ,isDigit+ ,isOctDigit+ ,isHexDigit+ ,isSpace+ ) where++import Fay.FFI++chr :: Int -> Char+chr = ffi "String.fromCharCode(%1)"++ord :: Char -> Int+ord = ffi "%1.charCodeAt(0)"++isAscii :: Char -> Bool+isAscii c = c < '\x80'++isLatin1 :: Char -> Bool+isLatin1 c = c <= '\xff'++toUpper :: Char -> Char+toUpper = ffi "%1.toUpperCase()"++toLower :: Char -> Char+toLower = ffi "%1.toLowerCase()"++isAsciiLower :: Char -> Bool+isAsciiLower c = c >= 'a' && c <= 'z'++isAsciiUpper :: Char -> Bool+isAsciiUpper c = c >= 'A' && c <= 'Z'++isDigit :: Char -> Bool+isDigit c = c >= '0' && c <= '9'++isOctDigit :: Char -> Bool+isOctDigit c = c >= '0' && c <= '7'++isHexDigit :: Char -> Bool+isHexDigit c = isDigit c || c >= 'A' && c <= 'F' ||+ c >= 'a' && c <= 'f'++isSpace :: Char -> Bool+isSpace = ffi "%1.replace(/\\s/g,'') != %1"