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
open WebSharper.UI.Next.Client | |
open WebSharper.UI.Next | |
open WebSharper.UI.Next.Html | |
module Material = | |
module Typography = | |
let flowText content = pAttr [ attr.``class`` "text-flow" ] [ text content ] | |
module Table = | |
type TableType = |
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
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context="MyActivity"> | |
<Button | |
android:id="@+id/my_button" | |
android:layout_width="wrap_content" |
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 FileExtension = | |
|PNG | |
|JPG | |
|GIF | |
|RAW | |
|BMP | |
|SVG | |
|PSD | |
type IsImageType = |
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
// Left represents error or bad case | |
var Left = function(x) { | |
this.__value = x; | |
}; | |
Left.of = function(x) { | |
return new Left(x); | |
}; | |
Left.prototype.map = function(f) { |
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 Maybe = function(x) { | |
this.__value = x; | |
}; | |
Maybe.of = function(x) { | |
return new Maybe(x); | |
}; | |
Maybe.prototype.isNothing = function() { | |
return (this.__value === null || this.__value === undefined); |
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 add = (x, y) => x + y | |
add(Identity.of(2), Identity.of(3)); // "[object Object][object Object]" | |
var map = curry(function(f, ary) { | |
return ary.map(f) | |
}); | |
var identityOf2 = map(add, Identity.of(2)); | |
// Identity(add(2)) |
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
// composition = f(g(x)) | |
var compose = function(f, g) { | |
return function(x) { | |
return f(g(x)); | |
} | |
} | |
var squareAdd10 = compose(square, add10); | |
[1, 2, 3, 4, 5].map(squareAdd10); // 11, 14, 19, 26, 35 | |
// or |
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 id = x => x | |
var xs = [1, 2, 3, 4, 5].map(id(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
var Person = function (name) { | |
this.name = name; | |
} | |
// ('a -> 'b -> Person<'b>) | |
Person.prototype.map = function (f) { | |
return new Person(f(this)); | |
} | |
var me = new Person("Andre"); |
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# | |
let xs = List.map (fun x -> x * 2) [1; 2; 3; 4; 5] | |
C# | |
var xs = Enumerable.Range(1, 5).Select(x => x * 2) | |
JS | |
var xs = [1, 2, 3, 4, 5].map(function(x) { return x * 2 }) |