Skip to content

Instantly share code, notes, and snippets.

View teivah's full-sized avatar
🧮
Current status: teivah/majorana

Teiva Harsanyi teivah

🧮
Current status: teivah/majorana
View GitHub Profile
applicativeEx :: Maybe Int
applicativeEx = Just (+ 1) <*> Just 42 -- Just 43
applicativeEx :: Maybe Int
applicativeEx = Just (+ 1) <*> Just 42 -- Just 43
@teivah
teivah / fmap.hs
Last active March 16, 2024 01:12
fmapEx :: [Int] -- A function returning a list
fmapEx = fmap (+ 1) [1, 2, 3] -- [2, 3, 4]
@teivah
teivah / fmap.hs
Last active March 16, 2024 00:43
fmapEx :: Maybe Int
fmapEx = fmap (Just (+ 1)) (Just 42) -- Does not compile
@teivah
teivah / fmap.hs
Last active March 16, 2024 00:34
fmapEx :: Maybe Int
fmapEx = fmap (+ 1) Nothing -- Nothing
@teivah
teivah / fmap.hs
Last active March 16, 2024 01:13
fmapEx :: Maybe Int -- A function returning a Maybe Int
fmapEx = fmap (+ 1) (Just 42) -- Nothing
package main
import (
"fmt"
"runtime"
)
func main() {
// Init
n := 1_000_000
t1 t2
Read InventorySize (100)
Read InventorySize (100)
Set InventorySize to 100 + 5 = 105
Set InventorySize to 100 + 10 = 110
Commit
Commit
t1 t2
Read A
Set A=1
Commit
...
Read A
t1 t2
Set A=0
Delete rows where A=0
Rollback
Commit