git clone https://github.com/ku-fpg/hermit
cd hermit
git checkout 'f0d7b767487'
cabal install --only-dep
cabal configure
cabal build
cabal install
http://www.paolocapriotti.com/assets/applicative.pdf
1.4 Example: applicative parsers The idea that monads are “too flexible” has also been explored, again in the context of parsing, by Swierstra and Duponcheel ([12]), who showed how to improve both performance and error-reporting capabilities of an embedded language for grammars by giving up some of the expressivity of monads. The basic principle is that, by weakening the monadic interface to that of an applicative functor (or, more precisely, an alternative
/a/ => char 'a'
/abcd/ => string "abcd"
sequence [ char 'a', char 'b', char 'c', char 'd' ]
(:) <$> char 'a' <*> string "bcd"
(++) <$> string "ab" <*> string "cd"
/[abcd]/ => oneOf "abcd"
/[^abcd]/ => noneOf "abcd"
/[a-z]/ => oneOf ['a'..'z']
Silly English-test but with some new words for me.
Hard test for modals
http://www.grammarbank.com/modal-verbs-test.html
2016-09-11 Проверим, сколько продержатся 2 батарейки #GPultraPlus alkaline в мышке.
-- source https://gist.github.com/ali-abrar/080f8696c446c477b007 | |
import Reflex.Dom | |
import Data.Monoid | |
main :: IO () | |
main = mainWidgetWithHead headWidget bodyWidget | |
headWidget = do | |
elAttr "link" ("href" =: "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" <> "rel" =: "stylesheet" <> "type" =: "text/css") $ return () |
ghcjs-boot --dev --ghcjs-boot-dev-branch ghc-8.0 --shims-dev-branch ghc-8.0 step2 min (max 3 4) 5
src/Reflex/Dom/Internal.hs:224:28-37: error:
* Expecting one more argument to `SpiderHost'
Expected kind `* -> *', but `SpiderHost' has kind `* -> * -> *'
* In the second argument of `HasPostGui', namely `SpiderHost'
In the instance declaration for
`HasPostGui Spider SpiderHost SpiderHost'
-- source https://gist.github.com/ali-abrar/bca8f372b3ca39317f86/ | |
{-# LANGUAGE JavaScriptFFI #-} | |
import Reflex.Dom | |
import qualified Data.Text as T | |
import Data.Monoid | |
import GHCJS.Types | |
import GHCJS.Foreign | |
import Control.Monad.IO.Class | |
import Control.Monad |
-- source https://gist.github.com/ali-abrar/47333e623b978d0472c2 | |
{-# LANGUAGE ScopedTypeVariables #-} | |
import Reflex.Dom | |
import GHCJS.DOM.CanvasRenderingContext2D (putImageData, setFillStyle, fillRect) | |
import GHCJS.DOM.HTMLCanvasElement (getContext) | |
import GHCJS.DOM.ImageData (newImageData') | |
import Control.Monad.IO.Class (liftIO) | |
import GHCJS.DOM.Types (CanvasStyle(..), CanvasRenderingContext2D(..), toJSString, castToHTMLCanvasElement) | |
import GHCJS.Marshal (toJSVal) | |
import Data.Time (getCurrentTime) |
-- source https://gist.github.com/ali-abrar/2a52593f3a391d82c40f439d4894f017 | |
{-# LANGUAGE ScopedTypeVariables, RankNTypes #-} | |
import Reflex.Dom | |
import Data.Monoid ((<>)) | |
import Data.List (isPrefixOf) | |
main :: IO () | |
main = mainWidgetWithHead headTag bodyTag | |
headTag :: MonadWidget t m => m () |
-- source https://gist.github.com/ali-abrar/6cdf28d6fb9c3dbe25fb | |
import Control.Monad.IO.Class | |
import GHCJS.DOM (webViewGetDomDocument) | |
import GHCJS.DOM.Document (getBody) | |
import GHCJS.DOM.Element (keyDown) | |
import GHCJS.DOM.EventM (on, preventDefault) | |
import Reflex.Dom | |
main :: IO () |