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
let g:ale_fix_on_save = 1 | |
let g:ale_fixers['haskell'] = ['hfmt'] | |
let g:ale_linters = { | |
\ 'haskell': ['ghc', 'hlint'], | |
\} | |
nmap <silent> <Leader>< <Plug>(ale_previous_wrap) | |
nmap <silent> <Leader>> <Plug>(ale_next_wrap) | |
nmap <silent> <Leader>? <Plug>(ale_detail) |
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
# See http://help.github.com/ignore-files/ for more about ignoring files. | |
# IDEs and editors | |
.idea/* | |
**/.idea/* | |
!.idea/codeStyleSettings.xml | |
!.idea/watcherTasks.xml | |
.project | |
.classpath | |
.c9/ |
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
function mapCompose<A, B, C>(mab: Map<A, B>, mbc: Map<B, C>): Map<A, C> { | |
const mac: Map<A, C> = new Map(); | |
mab.forEach((value, key) => { | |
const finalValue = mbc.get(value); | |
if (finalValue !== undefined) { | |
mac.set(key, finalValue); | |
} | |
}); |
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
asInt :: String -> Either String Int | |
asInt ('-':xs) = negate <$> asInt xs | |
asInt xs = | |
foldl | |
(\acc x -> acc >>= addNextDigit x) | |
(Right 0) | |
xs | |
where addNextDigit x acc = if isDigit x | |
then Right $ acc * 10 + digitToInt x | |
else Left $ "non-digit" |
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
// -- EXAMPLE THAT WOULD BE WRONG | |
// -- wrongBurgerSpec :: IxBurgerBuilder Ready TopBunOn BurgerSpec | |
// -- wrongBurgerSpec = getEmptyPlate | |
// -- :>>= placeEmptyBun | |
// -- :>>= addKetchup | |
// -- :>>= addCheese -- Can't match PattyOn with BottomBunOn, since we haven't put on the patty, the most important part!!! | |
// -- :>>= addOnions | |
// -- :>>= noLettuce | |
// -- :>>= addTomato | |
// -- :>>= addTopBun |
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
// -- OUR AMAZING INDEXED BURGER SPEC FROM READY TO TOP BUN ON | |
// burgerSpec :: IxBurgerBuilder Ready TopBunOn BurgerSpec | |
// burgerSpec = getEmptyPlate | |
// :>>= placeEmptyBun | |
// :>>= addKetchup | |
// :>>= addPatty | |
// :>>= addCheese | |
// :>>= addOnions | |
// :>>= noLettuce | |
// :>>= addTomato |
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
// getEmptyPlate :: IxBurgerBuilder Ready EmptyPlate BurgerSpec | |
// getEmptyPlate = IxBurgerBuilder mempty | |
const getEmptyPlate = new IxBurgerBuilder<Ready, EmptyPlate, BurgerSpec>([]); | |
// addIngredient :: forall i o. String -> BurgerSpec -> IxBurgerBuilder i o (BurgerSpec) | |
// addIngredient x xs = IxBurgerBuilder $ Ingredient x : xs | |
const addIngredient = <I, O>(s: string) => (spec: BurgerSpec) => new IxBurgerBuilder<I ,O, BurgerSpec>(spec.concat([s])); | |
// -- ADDING THE BUN | |
// placeEmptyBun :: BurgerSpec -> IxBurgerBuilder EmptyPlate BottomBunOn BurgerSpec |
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
import { Functor3 } from 'fp-ts/lib/Functor' | |
import { IxMonad3 } from 'fp-ts/lib/IxMonad'; | |
declare module 'fp-ts/lib/HKT' { | |
// IxBurgerBuilder :: * -> * -> * -> * | |
interface URI2HKT3<U, L, A> { | |
IxBurgerBuilder: IxBurgerBuilder<U, L, A> | |
} | |
} |
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
// data Ready | |
// data EmptyPlate | |
// data BottomBunOn | |
// data PattyOn | |
// data CheeseOn | |
// data OnionOn | |
// data LettuceOn | |
// data TomatoOn | |
// data PicklesOn | |
// data TopBunOn |
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
interface Boring { | |
bore: () => boolean | |
} | |
interface Fooable<A> { | |
foo: () => string, | |
unfoo: (s: string) => A | |
} | |
interface Barable<A> { |