case class Person(id: Long, name: String, organizationId: Long)
object Person {
def groupByOrg: Map[Long, Seq[Person]] = ...
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
extern crate regex; | |
use regex::Regex; | |
#[derive(Debug)] | |
enum ParseResult<T> { | |
Success { result: T, next: String }, | |
Failure | |
} | |
impl<T> ParseResult<T> { |
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
trait HApply[F[_[_]]] extends HFunctor[F] { | |
def apply2[A1[_], A2[_], Z[_]](a1: F[A1], a2: F[A2])(f: ({type l[a] = (A1[a], A2[a])})#l ~> Z): F[Z] | |
def apply3[A1[_], A2[_], A3[_], Z[_]](a1: F[A1], a2: F[A2], a3: F[A3])(f: ({type l[a] = (A1[a], A2[a], A3[a])})#l ~> Z): F[Z] = | |
apply2[({type l[a] = (A1[a], A2[a])})#l, A3, Z](tuple2(a1, a2), a3)( | |
new (({type l[a] = ((A1[a], A2[a]), A3[a])})#l ~> Z){ | |
def apply[a](fa: ((A1[a], A2[a]), A3[a])) = | |
f((fa._1._1, fa._1._2, fa._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
begin | |
class CreateModels < ActiveRecord::Migration | |
def change | |
create_table :items do |t| | |
end | |
create_table :events do |t| | |
t.belongs_to :item | |
end |
多くのWebサービス・インターネットサービスでは、今やデータの収集・処理・分析といったタスクが非常に重要なものになっていることは多くの方に賛同をいただけるものと思います。近年ではIoTというキーワードもよく話題になります。増え続けるデータの処理をどのようにするか、といった点に悩んでいるサービス事業者の方は多いのではないでしょうか。
この種のデータ処理・分析をどこでどうやって行うか、という問題は通常のWebサービスの開発とはかなり異なる知識と経験を要求されます。特にHadoopを中心とした分散処理基盤のデプロイとメンテナンスはこれまで多くの開発者を悩ませてきました。
一方、近年ではデータ処理・データ分析に特化したサービスもいくつも出てきました。自分でHadoopクラスタのセットアップ・運用をしなくても利用可能なこれらのサービスは特に開発者の少ないスタートアップで広く利用されるようになり、耳にされることも多いかもしれません。
このエントリでは、継続的に増え続けるデータ処理・分析の基盤にどのようなものがあり、どのようなケースで有効に利用できるか、自分の考えをまとめておこうと思います。これからのデータ処理基盤を考えている方には参考になるかもしれません。
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 Rank2Types #-} | |
import qualified Data.IntMap as IM | |
import Data.IORef | |
import Control.Monad.Writer | |
import Data.Foldable as F | |
import Data.Monoid | |
import Control.Applicative | |
import Control.Lens | |
newtype Builder a m = Builder { unBuilder :: forall r. (a -> m r) -> m r } |
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
module Promise where | |
import Control.Applicative (Applicative(..)) | |
import Data.Monoid (Monoid(..)) | |
newtype Error = Error { unString :: String } deriving (Eq, Ord, Read, Show) | |
data Promise a = Failed Error | Deferred | Fulfilled a | |
deriving (Eq, Ord, Read, Show) |
NewerOlder