This file contains hidden or 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 Main where | |
-- | Get octant points for a circle of given radius. | |
octant :: (Num a, Ord a) => a -> [(a, a)] | |
octant r = takeWhile inOctant . map fst $ iterate step ((r, 0), 1 - r) | |
where | |
-- check if we are still in octant | |
inOctant (x, y) = x >= y | |
-- go to the next point in the circle |
This file contains hidden or 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
#!/bin/sh | |
set -x | |
CIRCLE_TAG=`git name-rev --tags --name-only $(git rev-parse HEAD)` | |
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS | |
if [ "$CIRCLE_TAG" -ne "undefined" ]; then | |
docker tag user/repo user/repo:$CIRCLE_TAG |
This file contains hidden or 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
<!-- GetShopTV Analytics --> | |
<script> | |
(function(t,e,n,s,a,c,i){t.GetShopTVAnalyticsObject=a,t[a]=t[a]||function(){ | |
(t[a].q=t[a].q||[]).push(arguments)},t[a].l=1*new Date,c=e.createElement(n), | |
i=e.getElementsByTagName(n)[0],c.async=1,c.src=s,i.parentNode.insertBefore(c,i) | |
})(window,document,"script","//api.getshop.tv/static/analytics.js","gst"); | |
</script> | |
<!-- END GetShopTV Analytics --> | |
<!-- Manually trigger GetShopTV events wherever applicable --> |
This file contains hidden or 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 ConstraintKinds #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE RecordWildCards #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} |
This file contains hidden or 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 BinarySearch where | |
import Data.Vector.Unboxed (Vector, (!), Unbox) | |
import qualified Data.Vector.Unboxed as Vector | |
-- | Binary search in a Vector. | |
binary :: (Ord a, Unbox a) => a -> Vector a -> Int | |
binary x xs = binary' 0 (Vector.length xs - 1) | |
where | |
binary' a b |
This file contains hidden or 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 DeriveFunctor #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
module Control.Monad.Declare.Lazy where | |
import Control.Monad | |
import Control.Monad.Trans | |
import Data.Functor.Identity | |
import Data.Monoid |
This file contains hidden or 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 ConstraintKinds #-} | |
{-# LANGUAGE EmptyCase #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
module PDividing where | |
import Data.Foldable | |
import Data.Monoid | |
import Data.Profunctor |
This file contains hidden or 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 Contravariant1 p where | |
contramap1 :: (a -> b) -> p b x -> p a x | |
class Contravariant1 p => Divisible1 p where | |
conquer1 :: p a x | |
divide1 :: (a -> (b, c)) -> p b x -> p c x -> p a x | |
class Divisible1 p => Decidable1 p where | |
lose1 :: (a -> Void) -> p a x | |
choose1 :: (a -> Either b c) -> p b x -> p c x -> p a x |
This file contains hidden or 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 (Generic1 t, GDecidingR1 q (Rep1 t)) => DecidingR1 q t where | |
decidingR1 :: Decidable (f b) => p q -> (forall g. q g => f b (g a)) -> f b a -> f b (t a) | |
instance (Generic1 t, GDecidingR1 q (Rep1 t)) => DecidingR1 q t where | |
decidingR1 p f r = contramap from1 $ gdecidingR1 p f r | |
class GDecidingR1 q t where | |
gdecidingR1 :: Decidable (f b) => p q -> (forall g. q g => f b (g a)) -> f b a -> f b (t a) |
This file contains hidden or 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 Unit1 a | |
instance Unit1 a | |
gfoldMap :: (Deciding1 Unit1 f, Monoid m) => (a -> m) -> f a -> m | |
gfoldMap = flip . getOp $ deciding1 (Proxy :: Proxy Unit1) (Op mempty) (Op (flip id)) |