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 ServiceDiscovery | |
import ProfileService exposing (ProfileService) | |
profileService : Signal ProfileService | |
profileService = | |
let | |
nodes : Signal (List String) | |
nodes = ServiceDiscovery.discover "profile" | |
in | |
Signal.map ProfileService.init nodes |
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
with Task.andThen do | |
issues = Http.get "/issues.json" | |
milestones = Http.get "milestones.json" | |
in | |
assignMilestones (issues, milestones) | |
-- This would desugar to: | |
Task.andThen | |
(Http.get "/issues.json") |
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
{-| Returns a list of repeated applications of `f`. | |
If `f` returns `Nothing` the iteration will stop. If it returns `Just y` then | |
`y` will be added to the list and the iteration will continue with `f y`. | |
nextYear : Int -> Maybe Int | |
nextYear year = | |
if year >= 2030 then | |
Nothing | |
else |
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
The type annotation for `leftJoin` does not match its definition. | |
10│ leftJoin : Stream comparable v1 -> Stream comparable v2 -> Stream comparable (v1, Maybe v2) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
The type annotation is saying: | |
Signal ( comparable, a ) | |
-> Signal ( comparable, b ) | |
-> Signal ( comparable, ( a, Maybe b ) ) |
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
module Stream where | |
import Dict exposing (Dict) | |
type alias Stream comparable v = Signal (comparable, v) | |
leftJoin : Stream comparable v1 -> Stream comparable v2 -> Stream comparable (v1, Maybe v2) |
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
-- A user searched or changed to a new page of search results. | |
type Search = { query : SearchQuery, searchId : SearchId } | |
-- A user clicked a search result. | |
type Click = { searchId : SearchId, pageId : PageId } | |
-- A user viewed an article. | |
type PageView = { pageId : PageId } | |
type SearchQuery = String |
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
counts : List comparable -> List (comparable, Int) | |
counts items = | |
let | |
counts' items = | |
case items of | |
[] -> [] | |
(x, nx) :: [] -> [(x, nx)] | |
(x, nx) :: (y, ny) :: rest -> |
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
counts : List Int -> Dict Int Int | |
counts items = | |
List.map (\x -> Dict.singleton x 1) items | |
|> List.foldr (merge combine) Dict.empty | |
combine : Maybe Int -> Maybe Int -> Int | |
combine a b = | |
case (a, b) of | |
(Just a', Just b') -> a' + b' |
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
clicks : Signal (Int, Int) |
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
#!/bin/bash | |
local_branch=$(git for-each-ref --format="%(refname:short)" $(git symbolic-ref HEAD)) | |
remote_name=$(git config branch.$local_branch.remote) | |
remote_refspec=$(git config branch.$local_branch.merge) | |
remote_branch=${remote_refspec#refs/heads/} | |
remote_git_url=$(git config remote.origin.url) | |
remote_http_url=${remote_git_url#[email protected]:} | |
remote_http_url=${remote_http_url%.git} | |
github_url="https://github.com/$remote_http_url" |