View fizzbuzz.hs
module Main where
main :: IO ()
main = print $ fb <$> [0..15]
fb :: Int -> String
fb n = fallthrough (show n) concat [ (n `mod` 3 == 0, "Fizz")
, (n `mod` 5 == 0, "Buzz")
]
View parser.hs
import Control.Applicative
import Data.List
newtype Parser a = Parser { runParser :: String -> [(a, String)] }
parseConst :: a -> Parser a
parseConst a = Parser $ \s -> [(a, s)]
parseString :: String -> Parser String
parseString target = Parser p where
View parser.py
from collections import namedtuple
Lazy = namedtuple('Lazy', 'force')
def parseConst(a):
"""
>>> parseConst(1)('')
[(1, '')]
"""
View git_commands.wiki

Ask for help

    git --help
    git <command> --help

Commiting

  git commit -am wip
  git commit -m "Initial commit" --allow-empty
  git commit --amend --allow-empty --no-edit

View tuple_get.scala
object App {
// this integer references can be avoided when/if SIP-23 - Literal-based
// singleton types is implemented
val _1 = 1: Integer
val _2 = 2: Integer
val _3 = 3: Integer
// ... up to 22
trait TupleGet[T, A, N <: Integer] {
View modulo.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Main where
import Data.Proxy
import GHC.TypeLits
View sum10.hs
module Main where
import Control.Monad (guard)
import Data.List (tails, sort, group)
import qualified Data.Discrimination as D -- package `discrimination`
import qualified Data.IntSet as IS -- package `containers`
example :: [Int]
example = [-7,1,2,3,5,5,7,17]
View indirect.py
import pytest
@pytest.fixture()
def user(request):
user = 'mock user'
if hasattr(request, 'param'):
user += ': {}'.format(request.param)
return user
View Effects.elm
port module Main exposing (..)
-- effect types
type Prompt u
= Read (String -> u)
| Write String u
type Api u
= Get Int (String -> u)
View urm.hs
{-# LANGUAGE RecursiveDo #-}
import Control.Monad
import Control.Monad.Free
import Control.Monad.Writer
import Data.Functor.Identity
data Instruction = End
| Inc Int Int
| DeB Int Int Int