{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TemplateHaskell #-}
module Main where
import Control.Monad.Free
import Control.Monad.Free.TH
import Control.Monad.State
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
let firstCheckResult () : Result<unit, NotAuthorized> = | |
match firstCheck () with | |
| Some c when c.CanRead -> Ok () | |
| _ -> Error NotAuthorized | |
let secondCheckResult () : Result<unit, NotAuthorized> = | |
match secondCheck () with | |
| Some c when c.CanRead -> Ok () | |
| _ -> Error NotAuthorized |
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
match firstCheck () with | |
| Some c when c.CanRead -> Ok () | |
| _ -> | |
match secondCheck () with | |
| Some c when c.CanRead -> Ok () | |
| _ -> | |
match thirdCheck () with | |
| Some c when c.CanRead -> Ok () | |
| _ -> Error NotAuthorized |
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
maybe { | |
let! thingA = findThingA id | |
let! thingB = findThingB id | |
return combine thingA thingB | |
} |
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
let findThing id = | |
findThingA id | |
|> Option.bind (fun thingA -> | |
findThingB id | |
|> Option.bind (fun thingB -> | |
combine thingA thingB)) |
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
let findThing id = | |
match findThingA id with | |
| None -> None | |
| Some thingA -> | |
match findThingB id with | |
| None -> None | |
| Some thingB -> | |
combine thingA thingB |
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TemplateHaskell #-}
module Main where
import Control.Monad.Except (ExceptT)
import qualified Control.Monad.Except as Except
import Control.Monad.Free
Animations:
- shouldComponentUpdate
<StaticContainer>
- Element caching
- Raw DOM mutations
- data binding
Falcor:
Namespace your flux action types to prevent collisions:
function constants(namespace, constants) {
return Object.freeze(
constants.reduce((obj, constant) => {
return {
...obj,
[constant]: `${namespace}/${constant}`
}
NewerOlder