- Types are declared with
:
and not::
, and the consing operator conversely is::
instead of:
- No
where
clauses, onlylet/in
- The standard style is different, check http://elm-lang.org/docs/style-guide for reference
- Multiline strings are a thing with
"""
- Haskell's
data
corresponds totype
in Elm, and also, Haskell'stype
corresponds to Elm'stype alias
($)
is(<|)
, but you don't use it all that much – Elm people like the flipped operator(|>)
which lets you build something that reads like a pipeline- Related: Backticks will likely die soon in favour of functions that have an argument order that lends itself to pipelining with
(|>)
- Also,
(.)
is(<<)
, and a flipped version(>>)
exists, but I don't see it used that much either (>>=)
is not an available operator and would not be polymorphic (no typeclasses, see below), and is instead commonly namedSomeType.andThen
– e.g.Maybe.andThen : Maybe a -> (a -> Maybe b) -> Maybe b
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
var fs = require('fs'); | |
var options = { | |
key: fs.readFileSync('key.pem'), | |
cert: fs.readFileSync('cert.pem') | |
}; | |
var app = require('https').createServer(options); | |
var io = require('socket.io')(app); |
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 com.futuresimple.base.provider; | |
import com.google.common.collect.Iterables; | |
import android.content.ContentResolver; | |
import android.database.ContentObservable; | |
import android.database.ContentObserver; | |
import android.database.Cursor; | |
import android.database.CursorWrapper; | |
import android.net.Uri; |
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 | |
# Map LISTENing TCP ports to their PIDs using lsof | |
LSOF=/usr/sbin/lsof | |
# e.g. netstat -an | |
# 127.0.0.1.25 *.* 0 0 49152 0 LISTEN | |
# *.22 *.* 0 0 49152 0 LISTEN |
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
// Created by STRd6 | |
// MIT License | |
// jquery.paste_image_reader.js | |
(function($) { | |
var defaults; | |
$.event.fix = (function(originalFix) { | |
return function(event) { | |
event = originalFix.apply(this, arguments); | |
if (event.type.indexOf('copy') === 0 || event.type.indexOf('paste') === 0) { | |
event.clipboardData = event.originalEvent.clipboardData; |
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
/* | |
* Copyright (C) 2014 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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 Html exposing (..) | |
import Keyboard | |
import Window exposing (Size) | |
import AnimationFrame | |
import Task | |
import Html.App as App | |
import Collage exposing (..) | |
import Element exposing (..) |
A primer/refresher on the category theory concepts that most commonly crop up in conversations about Scala or FP. (Because it's embarassing when I forget this stuff!)
I'll be assuming Scalaz imports in code samples, and some of the code may be pseudo-Scala.
A functor is something that supports map
.
OlderNewer