This file contains 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
module CSS.Cursor where | |
import Prelude | |
import CSS (CSS) | |
import CSS.Property (class Val, Value) | |
import CSS.String (fromString) | |
import CSS.Stylesheet (key) | |
newtype Cursor = Cursor Value |
This file contains 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
module Image.BookCover where | |
bookCover :: String | |
bookCover = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAFLCAIAAAC2j8WeAAAGOmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iCiAgICB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iCiAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIKICAgIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIgogICAgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIKICAgZXhpZjpDb2xvclNwYWNlPSIxIgogICBleGlmOlBpeGVsWERpbWVuc2lvbj0iMjU2IgogICBleGlmOlBpeGVsWURpbWVuc2lvbj0iMzMxIgogICBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIgogICB |
This file contains 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
module ChalkStyles | |
( | |
Style | |
, black | |
, red | |
, green | |
, yellow | |
, blue | |
, magenta | |
, cyan |
This file contains 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
module ChalkStyles where | |
newtype Style = Style String | |
black :: Style | |
black = Style "black" | |
red :: Style | |
red = Style "red" |
This file contains 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
const http = require("http"); | |
const hostname = "0.0.0.0"; | |
const port = 3000; | |
const server = http.createServer((req, res) => { | |
console.log(`\n${req.method} ${req.url}`); | |
console.log(req.headers); | |
const reverseArray = a => { |
This file contains 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
module Main where | |
import Prelude | |
import Control.Monad.Except.Trans (ExceptT, runExceptT, throwError, catchError) | |
import Control.Monad.State.Trans (StateT, runStateT, get, put) | |
import Control.Monad.Writer.Trans (class MonadTell, WriterT, runWriterT, tell) | |
import Data.Either (Either) | |
import Data.Tuple (Tuple) | |
import Effect.Console as Console |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
How to Think about Monads, starts with composition of pure functions and quickly transitioned to composition of pure functions with side-effects. If you haven't read it yet, please do. This continues where that left off.
By the end of that article, we created specialized composition functions that were equivalent to the Monadic bind
.
From that article we can conclude that Monadic computations have the following properties:
- Functions are executed sequentially
- Optionally, control-flow can be short-circuited
The following code was inspired by Kwang's Haskell Blog post titled unfold and fold.
module Main where
import Prelude hiding (foldr)
import Data.Function ((&))
NewerOlder