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
{-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses, TemplateHaskell, OverloadedStrings #-} | |
import Yesod | |
import Yesod.Core.Handler | |
data HelloWorld = HelloWorld | |
mkYesod "HelloWorld" [parseRoutes| | |
/ HomeR GET | |
|] |
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
#!/bin/sh | |
# iterm_open_with - open a URL, file from CWD, full path, or path with linenumber in default app or Sublime Text if text file | |
# For usage with iTerm2: | |
# In iTerm's Preferences > Profiles > Default > Advanced > Semantic History, | |
# choose "Run command..." and enter "/your/path/to/iterm_open_with \5 \1 \2". | |
# Usage: iterm_open_with $(pwd) filename [linenumber] | |
# $(pwd) = current working directory (either use `pwd` or $PWD) | |
# filename = filename to open | |
# lineno = line number | |
pwd=$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
type Address = { | |
street: string | |
zipCode: string | |
} | |
type Contact = { | |
name: string | |
phoneNumber: string | |
email: 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
import java.util.Map; | |
// This is almost a solution to the expression problem, except for | |
// lines 47 and 74. | |
// Instead of raising an exception, we want the program to fail to | |
// compile if there are cases that we haven't considered. | |
class Extend { | |
// I can define a data structure by cases. |
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
-- | Can pattern match on nonempty lists | |
-- | |
-- @ | |
-- import Custom.NonEmpty (head, pattern NEL) | |
-- let arr = [1,2,3] | |
-- case arr of | |
-- NEL ne -> head ne | |
-- [] -> 42 | |
-- @ | |
-- |