export OPT=/opt
export BUILDS=/some/where/mini_linux
mkdir -p $BUILDS
Sample types:
isDigit :: Monad f => Char -> f Bool
any :: Monad f => (a -> f Bool) -> [a] -> f Bool
reverse :: Monad f => [a] -> f [a]
map :: Monad f => (a -> f b) -> [a] -> f [b]
"hello" :: Monad f => f String
putStrLn :: (MonadIO f) => String -> f ()
show :: (Show a,Monad f) => a -> f String
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
*** Exception: Couldn't resolve constraint | |
<record getter> | |
due to problem | |
missing field for field access | |
arising from record-error.hell:2:24 |
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
// Define the custom HTMX extension | |
htmx.defineExtension('trigger-href', { | |
onEvent: function(name, evt) { | |
// <https://htmx.org/events/#htmx:afterProcessNode> | |
if (name == 'htmx:afterProcessNode') { | |
const es = evt.detail.elt.querySelectorAll('a[hx-trigger-href]'); | |
for (const e of es) { | |
if (typeof e.href == 'string') { | |
e.addEventListener('click',(e) => { | |
e.stopPropagation(); |
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
-------------------------------------------------------------------------------- | |
-- Variants | |
-- NB: By the types here, you can't construct a @Variant NilL@. | |
data Variant xs where | |
LeftV :: forall k a xs. a -> Variant (ConsL k a xs) | |
RightV :: Variant xs -> Variant (ConsL k a xs) | |
-- Construction: | |
bar :: Variant (ConsL "String" Text (ConsL "Number" Double NilL)) |
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
-- RHS size: {terms: 254, types: 135, coercions: 0} | |
Xeno.$wparse [InlPrag=[0]] | |
:: GHC.Prim.Addr# | |
-> GHC.ForeignPtr.ForeignPtrContents | |
-> GHC.Prim.Int# | |
-> GHC.Prim.Int# | |
-> () | |
[GblId, | |
Arity=4, | |
Str=DmdType <L,U><L,U><L,U><S,U>, |
Basic unit type:
λ> replTy "()"
() :: ()
Basic functions:
BUILDKIT_PROGRESS=plain docker image build . -t ghc-javascript:2024-10-10
$ docker run -v`pwd`:`pwd` -w`pwd` --rm ghc-javascript:2024-10-10 ghcjs HelloJS.hs
[1 of 2] Compiling Main ( HelloJS.hs, HelloJS.o )
[2 of 2] Linking HelloJS.jsexe
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
#!/usr/bin/env hell | |
-- How to run this: | |
-- | |
-- socat TCP-LISTEN:8081,fork,reuseaddr,max-children=20 EXEC:"./handler.hell" | |
main = do | |
line <- Text.getLine | |
let content = | |
Text.concat ["<h1>Hello, World!</h1><p>This is generated by Hell.</p><pre>", line, "</pre>"] |
NewerOlder