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 UIKit | |
import CoreData | |
public struct MyThing: Codable { | |
var state: Bool? = nil | |
var value: String? = nil | |
} | |
class ViewController: UIViewController, UITextViewDelegate { |
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
using System; | |
using System.Net.Http; | |
using System.Security.Cryptography; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Linq; | |
namespace YoApp | |
{ |
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
-- executable awsenv | |
-- main-is: awsenv.c | |
-- hs-source-dirs: awsenv | |
-- default-language: Haskell2010 | |
-- x-exe-type: bash | |
import Data.Maybe | |
import Distribution.Simple | |
import Distribution.Simple.Setup |
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
// this is a playground | |
protocol Nat { | |
class func construct() -> Self | |
class func value() -> Int | |
} | |
struct Z : Nat { | |
static func construct() -> Z { | |
return Z() | |
} |
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
class F<A> { | |
} | |
protocol Functor { | |
typealias A | |
typealias B | |
typealias FA = F<A> | |
typealias FB = F<B> | |
func fmap(a: FA, fn: (A -> B)) -> FB | |
} |
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
sealed trait Shape[P] | |
case class Void[P]() extends Shape[P] | |
case class Unit[P]() extends Shape[P] | |
case class Value[P, A](a: A) extends Shape[P] | |
case class Meta[P, T <: Tag](shape: Shape[P]) extends Shape[P] | |
sealed trait Sum[P] extends Shape[P] { | |
val shape: Shape[P] | |
} | |
case class Left[P](shape: Shape[P]) extends Sum[P] |
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
:set -XTemplateHaskell | |
:set -XOverloadedStrings | |
:set -XQuasiQuotes | |
:set -XMultiParamTypeClasses | |
:set -XFunctionalDependencies | |
:set -XFlexibleInstances | |
:set -XUndecidableInstances | |
:set -XGeneralizedNewtypeDeriving | |
:set -XFlexibleContexts | |
:set -XScopedTypeVariables |
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 TagField | |
import Data.Text (Text) | |
import Data.Aeson | |
data Banana = Banana | |
{ shape :: Field "banana-shape" Text | |
, size :: Field "banana size" (Maybe Int) | |
, name :: Field "banana's name" Text | |
} deriving Show |
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 OverloadedStrings, TemplateHaskell, QuasiQuotes #-} | |
import Data.Aeson | |
import Data.Monoid | |
import Data.Text (Text, unpack) | |
import Control.Monad.Writer | |
import qualified Data.Map as M | |
import qualified Data.Vector as V | |
import qualified Data.HashMap.Strict as H | |
import Language.Haskell.TH |
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
data EL = O (H.HashMap Text EL) | |
| V EL | |
| S | N | B | E | |
| T | U | |
deriving Show | |
instance Monoid EL where | |
mempty = U | |
U `mappend` U = U |
NewerOlder