Skip to content
This repository
Browse code

fix of missing upper/lowercase conversion primitives for Data.Char

  • Loading branch information...
commit 50b2692ff0b76d3a0c27d49c9bb24713f7752879 1 parent 83c2f06
atzedijkstra atzedijkstra authored
4 EHC/ehclib/uhcbase/Data/Char.hs
@@ -229,8 +229,8 @@ isLatin1 c = c <= '\xff'
229 229 isControl c = c < ' ' || c >= '\DEL' && c <= '\x9f'
230 230 isPrint c = c >= ' '
231 231
232   -foreign import ccall "primCharToUpper" toUpper :: Char -> Char
233   -foreign import ccall "primCharToLower" toLower :: Char -> Char
  232 +foreign import prim "primCharToUpper" toUpper :: Char -> Char
  233 +foreign import prim "primCharToLower" toLower :: Char -> Char
234 234
235 235 #endif
236 236
34 EHC/src/ehc/Core/CommonBindExtract.cag
@@ -40,31 +40,19 @@ ATTR
40 40 ]
41 41
42 42 SEM CBound
43   - | Val lhs . (selvalYesL,selvalNoL)
44   - = if selVal @lhs.boundsel @aspectKeyS @mlev @lbl
45   - then ([@boundval],[])
46   - else ([],[@boundval])
47   - | Bind lhs . (selvalYesL,selvalNoL)
48   - = if selBind @lhs.boundsel
49   - then ([@boundval],[])
50   - else ([],[@boundval])
51   - | Meta lhs . (selvalYesL,selvalNoL)
52   - = if selMeta @lhs.boundsel @aspectKeyS
53   - then ([@boundval],[])
54   - else ([],[@boundval])
55   - | RelevTy lhs . (selvalYesL,selvalNoL)
56   - = if selRelevTy @lhs.boundsel @aspectKeyS @relevTy
57   - then ([@boundval],[])
58   - else ([],[@boundval])
59   - | Ty lhs . (selvalYesL,selvalNoL)
60   - = if selTy @lhs.boundsel @aspectKeyS
61   - then ([@boundval],[])
62   - else ([],[@boundval])
  43 + | Val loc . isSelected = selVal @lhs.boundsel @aspectKeyS @mlev @lbl
  44 + | Bind loc . isSelected = selBind @lhs.boundsel
  45 + | Meta loc . isSelected = selMeta @lhs.boundsel @aspectKeyS
  46 + | RelevTy loc . isSelected = selRelevTy @lhs.boundsel @aspectKeyS @relevTy
  47 + | Ty loc . isSelected = selTy @lhs.boundsel @aspectKeyS
63 48 %%[[90
64   - | FFE lhs . (selvalYesL,selvalNoL)
65   - = if selFFE @lhs.boundsel
  49 + | FFE loc . isSelected = selFFE @lhs.boundsel
  50 +%%]]
  51 +
  52 +SEM CBound
  53 + | * lhs . (selvalYesL,selvalNoL)
  54 + = if @isSelected
66 55 then ([@boundval],[])
67 56 else ([],[@boundval])
68   -%%]]
69 57 %%]
70 58
6 EHC/src/javascript/rts/prim.cjs
@@ -283,6 +283,12 @@ primCharIsUpper = function(x) {
283 283 primCharIsLower = function(x) {
284 284 return PrimMkBool(x > 96 && x < 123) ;
285 285 }
  286 +primCharToLower = function(charCode) {
  287 + return String.fromCharCode(charCode).toLowerCase().charCodeAt(0);
  288 +};
  289 +primCharToUpper = function(charCode) {
  290 + return String.fromCharCode(charCode).toUpperCase().charCodeAt(0);
  291 +};
286 292 %%]
287 293
288 294 Represent packed strings as Javascript strings

0 comments on commit 50b2692

Please sign in to comment.
Something went wrong with that request. Please try again.