更新: | 2015-10-03 |
---|---|
作者: | @voluntas |
バージョン: | 1.0.0 |
URL: | http://voluntas.github.io/ |
概要
#!/bin/sh | |
# Debian has older Erlang package (R15) in official repositories, Elixir requires newer (R17) | |
wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb | |
sudo dpkg -i erlang-solutions_1.0_all.deb | |
sudo apt-get update | |
sudo apt-get install -y erlang | |
rm erlang-solutions_1.0_all.deb | |
# compile Elixir from source |
BracketExpr(Sym(typeDesc), Sym(test_obj)) | |
ObjectTy(Empty(), RecList(Sym(x), Sym(y), Sym(z), Sym(a))) | |
x:int | |
y:float | |
z:string | |
a:array[range[0, 4], int] | |
BracketExpr(Sym(typeDesc), BracketExpr(Sym(array), BracketExpr(Sym(range), IntLi | |
t(0), IntLit(4)), Sym(int))) |
defmodule Curried do | |
defmacro defc({name, _, args}, [do: body]) do | |
curried_args = Enum.map(Enum.with_index(args), fn({_, index}) -> | |
Enum.take(args, index + 1) | |
end) | |
for a <- curried_args do | |
if a == Enum.at(curried_args, Enum.count(curried_args) - 1) do | |
quote do | |
def unquote(name)(unquote_splicing(a)) do | |
unquote(body) |
更新: | 2015-10-03 |
---|---|
作者: | @voluntas |
バージョン: | 1.0.0 |
URL: | http://voluntas.github.io/ |
概要
import com.twitter.finagle.Http | |
import com.twitter.util.Await | |
import io.finch._ | |
import io.finch.response.EncodeResponse.encodeString | |
import io.finch.circe._ | |
object Main { | |
val hello: Endpoint[String] = | |
get("hello") { |
import com.twitter.finagle.Http | |
import com.twitter.util.{Future, Await} | |
import io.finch._ | |
object Test1 extends App { | |
implicit val encodeMap: EncodeResponse[Map[String, String]] = | |
EncodeResponse("text/plain")(map => | |
Buf.Utf8(map.toSeq.map(kv => kv._1 + ":" + kv._2).mkString("\n")) | |
) |