Skip to content

Instantly share code, notes, and snippets.

{-# LANGUAGE InstanceSigs #-}
-- import Geometry
import qualified Data.Map as Map
import Data.Char
import Data.List
import Data.Monoid
import qualified Data.Foldable as F
import Control.Applicative
import Control.Monad
import S from 'sanctuary'
import _ from 'lodash'
/*
mix 將所有 prototype property 全部複製成新的 prototype ,而 prototype prototype 一層一層合成複製起來,才能維持原本的階層架構
mix function 不能有任何帶有任何參數,因為想要從mix的先後順序呼叫 Constructors
Symbol.(mixPrototypes) 紀錄所以有 Constructors
根據 特性 實作各自繼承組合起來
例如: MonoidArray MonadArray 各自的 定義 mix 起來 變成實際使用的 Array
{
"error": 0,
"status": "Success",
"date": "2014-02-13",
"result": {
"name": "颐和园",
"location": {
"lng": 116.27068715319,
"lat": 39.993241267979
},
@lin1987www
lin1987www / stackManip.hs
Last active October 25, 2018 03:04
Haskell stackManip
{-
多行註解
-}
-- 單行註解
{-
We'll say that a stateful computation is a function that takes some state and returns a value along with some new state.
s -> (a,s)
@lin1987www
lin1987www / Writer2.hs
Created October 17, 2018 15:23
Haskell - The Writer type
{-
learnyouahaskell.com/for-a-few-monads-more#writer
-}
newtype Writer2 w a = Writer2 { runWriter2 :: (a, w) } deriving (Eq, Show)
instance Functor (Writer2 w) where
fmap f m = let
(a, w) = (runWriter2 m)
in Writer2 (f a, w)
@lin1987www
lin1987www / EventBusUtils.java
Last active September 10, 2015 07:37
EventBus.StickyEventKeeper
package com.lin1987www.app;
import android.os.Bundle;
import android.os.Parcel;
import android.util.Log;
import java.lang.reflect.Field;
import java.util.Map;
import de.greenrobot.event.EventBus;
@lin1987www
lin1987www / OkConnectionFactory.java
Created September 10, 2015 07:13
com.github.kevinsawicki.http.OkConnectionFactory
package com.github.kevinsawicki.http;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.OkUrlFactory;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.Proxy;
import java.net.URL;