Skip to content

Instantly share code, notes, and snippets.

import scala.collection.immutable.Queue
import scalaz.Monoid
case class BQ[A](private val q: Queue[A], n: Int) {
private def bound(qq: Queue[A]): Queue[A] = {
val s = qq.size
if (s > n)
qq.drop(n - s)
else
infixl 4 <&&
(<&&) :: Functor f => f (a -> b) -> a -> f b
(<&&) = \f a -> fmap ($ a) f
Ϟ *Main
λ let x = 1 :/ 'a' :/ 2 :/ 'c' :/ ABNil
Ϟ *Main
λ :t x
x :: ABList Integer Char
⛅ ~/tehcodez/scalaz (scalaz-seven)
⚡ grep -ri 'haskell' .
./core/src/main/scala/scalaz/BKTree.scala: * This implementation is a port of Haskell's [[http://hackage.haskell.org/packages/archive/bktrees/0.2.1/doc/html/src/Data-Set-BKTree.html Data.Set.BKTree]]
./core/src/main/scala/scalaz/ContravariantCoyoneda.scala: * @see http://hackage.haskell.org/package/kan-extensions-4.0.1/docs/Data-Functor-Contravariant-Coyoneda.html
./core/src/main/scala/scalaz/DList.scala: * Based on `Data.DList`, a Haskell library by Don Stewart.
./core/src/main/scala/scalaz/Heap.scala: * Based on the heaps Haskell library by Edward Kmett
./core/src/main/scala/scalaz/ISet.scala:// http://www.haskell.org/ghc/docs/latest/html/libraries/containers-0.5.0.0/src/Data-Set-Base.html#Set
./core/src/main/scala/scalaz/ISet.scala: * Documentation as copied from the Haskell source:
./core/src/main/scala/scalaz/InvariantFunctor.scala: * @see [[http://hackage.haskell.org/packages/archive/invariant/latest/doc/html/Data-Functor-Invariant.html]]
./c
import Data.List.NonEmpty
import Control.Applicative
import Prelude hiding (foldl1)
import Data.Foldable (foldl1)
isA :: a -> Bool
isA = undefined
isB :: a -> Bool
isB = undefined
import Data.Semigroup
import Data.List.NonEmpty
isA :: a -> Bool
isA = undefined
isB :: a -> Bool
isB = undefined
isC :: a -> Bool
import Data.Semigroup
import Data.List.NonEmpty
isA :: a -> Bool
isA = undefined
isB :: a -> Bool
isB = undefined
isC :: a -> Bool
import Control.Applicative
isA :: a -> Bool
isA = undefined
isB :: a -> Bool
isB = undefined
isC :: a -> Bool
isC = undefined
@techtangents
techtangents / Evens.hs
Last active December 28, 2015 16:08
Encoding even integers using integers.
{-
bryanwoods: Haskell folk: Any way to type a function like
generateEvens = [x | x <- [1..], x `mod` 2 == 0]
such that it always returns even numbers?
pedrofurla: @bryanwoods @puffnfresh in ghci `let generateEvens = ...` compiled just fine here
bryanwoods: @pedrofurla I was wondering if I could write a type signature like: generateEvens :: [EvenNumber]
data Effect = Effect {
unsafePerform :: ()
}
data Effect1 a = Effect1 {
unsafePerform1 :: a -> ()
}
effectToEffect1 :: Effect -> Effect1 a
--effectToEffect1 fx = Effect1 (\_ -> unsafePerform fx)