Created
October 6, 2015 16:57
-
-
Save et4te/54272174040d1a76f9ff to your computer and use it in GitHub Desktop.
Gives 'non-exhaustive pattern' in Basic at Console
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| listItemAttrDyn False = | |
| "class" =: "list-item" | |
| listItemAttrDyn True = | |
| "class" =: "list-item highlight" | |
| listItem :: (MonadWidget t m) => (String -> String) -> m (ListItem t) | |
| listItem mkUrl = do | |
| rec highlightDyn <- foldDyn (\a _ -> a) False highlightE | |
| itemAttributesDyn <- mapDyn listItemAttrDyn highlightDyn | |
| (li, deleteBtn) <- elDynAttr' "li" itemAttributesDyn $ do | |
| el "span" $ do | |
| text "UUID" | |
| el "span" $ do | |
| text "Label" | |
| el "span" $ do | |
| button "Delete" | |
| let mouseOverE = fmap (const True) $ domEvent Mouseover li | |
| let mouseOutE = fmap (const False) $ domEvent Mouseout li | |
| let highlightE = mergeWith (\ _ _ -> True) [mouseOverE, mouseOutE] | |
| return $ ListItem { | |
| listItemClick = fmap (const $ mkUrl "/create") $ domEvent Click li | |
| , listItemDelete = fmap (const $ mkUrl "/delete") deleteBtn | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment