Skip to content

Instantly share code, notes, and snippets.

Avatar

Lena Milizé lovelymono

View GitHub Profile
@lovelymono
lovelymono / Parser.hs
Created May 3, 2022
Baseline for parser combinators in Haskell
View Parser.hs
import qualified Data.Text as T
data Error = EndOfInput | Unexpected Char
deriving (Eq, Show)
-- Parser from T.Text to some type a.
data Parser a = Parser { runParser :: T.Text -> Either Error (a, T.Text) }
satisfy :: (Char -> Bool) -> Parser Char
satisfy p = Parser $ \input ->
@lovelymono
lovelymono / dialog.html
Created Apr 12, 2022
Native dialog in HTML
View dialog.html
<!-- You can use JSBin: https://jsbin.com/xoketogeda/edit?html,output to play around with it. -->
<!-- The dialog element is specified in HTML specification, §4.11.4 "The dialog
element": https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element. -->
<button onclick="document.querySelector('dialog').showModal()">Open dialog</button>
<dialog style="width: 50%;">
<h1>Native <code>&lt;dialog&gt;</code></h1>