Permalink
Browse files

Now works with the new getAttr

  • Loading branch information...
1 parent 07628ab commit aa6ed206c941e7de1edb2c40b266e3bb8dcbbccc @spockz committed Jan 9, 2012
Showing with 8 additions and 8 deletions.
  1. +6 −7 resources/static/hjs/Models.hs
  2. +2 −1 resources/static/hjs/jcu.hs
@@ -29,15 +29,14 @@ data Rule = Rule {
data JSRulePtr
type JSRule = JSPtr JSRulePtr
-instance FromJS JSRule Rule where
+instance FromJS JSRule (IO Rule) where
fromJS = jsRule2Rule
-jsRule2Rule :: JSRule -> Rule
-jsRule2Rule ptr = Rule {
- id = getAttr "id" ptr,
- ro = getAttr "ro" ptr,
- rule = getAttr "rule" ptr
- }
+jsRule2Rule :: JSRule -> IO Rule
+jsRule2Rule ptr = do id <- getAttr "id" ptr
+ ro <- getAttr "ro" ptr
+ rule <- getAttr "rule" ptr
+ return $ Rule id ro rule
proofTreeNode = Node "" "" [] ""
@@ -156,7 +156,8 @@ addRules :: AjaxCallback (JSArray JSRule)
addRules obj str obj2 = do
-- slet rules = (Data.List.map fromJS . elems . jsArrayToArray) obj
f <- mkEachIterator (\idx e -> do
- let rt = (rules_list_item .fromJS . rule . jsRule2Rule) e
+ rule' <- jsRule2Rule e
+ let rt = rules_list_item ((fromJS . rule) rule')
rules_list_div <- jQuery "#rules-list-div"
rules_list_ul <- jQuery "<ul id=\"rules-list-view\"/>"
append rules_list_div rules_list_ul

0 comments on commit aa6ed20

Please sign in to comment.