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
import io from 'socket.io-client' | |
const A = require('automerge') | |
const foo = bar => { | |
bar.map( b => b.title ) | |
} | |
startConnection() { | |
this.socket = io('http://localhost:5000') |
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
-- f (x:xs) = case x `elem` xs of | |
-- True -> f xs | |
-- False -> x | |
f s = f' $ map toLower s | |
where | |
f' (x:xs) = | |
case x `elem` xs of | |
True -> f' xs | |
False -> x |
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 Control.Monad.State | |
import System.Directory | |
import System.Exit | |
import System.FilePath | |
import Data.Time | |
data File = File | |
{ name :: FilePath |
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
{- | |
Functionality: | |
- Read all folders and sub-folders with structure like below | |
- store all folder and file info in State monad, | |
- at the end of the loop, print it. | |
├── aaa | |
│ ├── b | |
│ │ ├── b1 | |
│ │ │ ├── b1-1 |
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 Bar () where | |
import Data.Maybe | |
import Control.Monad.State | |
import qualified Data.Map as M | |
data Item = Item { | |
sId :: String, | |
pId :: String, | |
value :: [Char], | |
children :: [String] |
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
data Item = Item { | |
sId :: String, | |
pId :: String, | |
value :: [Char], | |
children :: [Item] | |
} deriving (Show) | |
list :: [Item] | |
list = [ | |
Item { sId="1", pId="0", value="1", children=[] }, |
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
data Item = Item { | |
sId :: String, | |
pId :: String, | |
value :: [Char], | |
children :: [String] | |
} deriving (Show) | |
list :: [Item] | |
list = [ | |
Item { sId="1", pId="0", value="1", children=[] }, |
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 Bar | |
( | |
) where | |
import System.IO | |
import System.Environment | |
import Control.Monad | |
import Data.Maybe | |
import Data.List | |
import Control.Monad.Writer |
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
big :: Int | |
big = | |
-- (\x -> x - 1) -- 可以 | |
(-1) -- 不行 | |
$ length | |
$ takeWhile (< 10) | |
$ scanl (\acc x -> sqrt x + acc) 0 [1..] |
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 Task = require('data.task') | |
const { List, Map } = require('immutable-ext') | |
const { Pair, Sum, Intersection } = require('./monoid') | |
const { findArtist, relatedArtists } = require('./spotify') | |
const Bulk = (...xs) => ({ | |
xs, | |
concat: ys => Bulk(...xs.map( (x, idx) => x.concat(ys.xs[idx]) )), | |
bulkMap: (...fs) => Bulk(...xs.map((x, idx) => fs[idx](x))), | |
toList: _ => xs, |