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
applicativeEx :: Maybe Int | |
applicativeEx = Just (+ 1) <*> Just 42 -- Just 43 |
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
applicativeEx :: Maybe Int | |
applicativeEx = Just (+ 1) <*> Just 42 -- Just 43 |
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
fmapEx :: [Int] -- A function returning a list | |
fmapEx = fmap (+ 1) [1, 2, 3] -- [2, 3, 4] |
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
fmapEx :: Maybe Int | |
fmapEx = fmap (Just (+ 1)) (Just 42) -- Does not compile |
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
fmapEx :: Maybe Int | |
fmapEx = fmap (+ 1) Nothing -- Nothing |
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
fmapEx :: Maybe Int -- A function returning a Maybe Int | |
fmapEx = fmap (+ 1) (Just 42) -- Nothing |
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
package main | |
import ( | |
"fmt" | |
"runtime" | |
) | |
func main() { | |
// Init | |
n := 1_000_000 |
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
t1 | t2 | |
---|---|---|
Read InventorySize (100) | ||
Read InventorySize (100) | ||
Set InventorySize to 100 + 5 = 105 | ||
Set InventorySize to 100 + 10 = 110 | ||
Commit | ||
Commit |
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
t1 | t2 | |
---|---|---|
Read A | ||
Set A=1 | ||
Commit | ||
... | ||
Read 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
t1 | t2 | |
---|---|---|
Set A=0 | ||
Delete rows where A=0 | ||
Rollback | ||
Commit |