Skip to content

Instantly share code, notes, and snippets.

@techtangents
techtangents / jenkins.txt
Created April 5, 2013 02:53
How to remove the horrible hover menu popups in Jenkins.
Install "Simple Theme Plugin" - this gives you some theme settings
Configure System > URL of theme CSS = /userContent/noBreadcrumbPopups.css
This maps to something like /var/lib/jenkins/home/userContent/noBreadcrumbPopups.css
Create this file with contents:
#breadcrumb-menu, #breadcrumb-menu * {
display: none !important;
@techtangents
techtangents / gist:5737508
Last active December 18, 2015 06:08
RE: benkolera: Even though it makes your DSL shiny-ish, overloading functions is a PitA to a FP library user. Please use a sum type instead. #bad #scala etorreborre: @benkolera I'm clearly guilty of this but I don't quite get why it is so bad. Pointers?
Let's use Scala as the implementation language.
Say you have an API function setFoo, that is overloaded for Chook and Dog.
One might call it either of these ways:
setFoo(chook)
setFoo(dog)
As an API user, I wish to call this function from another function
def q(c: Chook) {
Simon Peyton-Jones
Phillip Wadler
Paul Chiusano
Tony Morris
Mark Hibberd
Edwin Brady
John Carmack
Conor McBride
Evan Czaplicki
Brian McKenna
/** applyF :: ((a -> b), a) -> b */
public static <A, B> F2<F<A, B>, A, B> applyF() {
return new F2<F<A, B>, A, B>() {
@Override
public B apply(final F<A, B> f, final A a) {
return f.apply(a);
}
};
}

There seems to be a lot of confusion around Effects and IO. I wanted to collect a set of questions and answers, and explanations of common misconceptions.

  1. What is an Effect?
  2. What is a Side Effect?
  3. What is a pure function?
  4. What is equational reasoning?
  5. What is an IO?
  6. Is the purpose IO value used to model an effectful computation, such that it can be composed with other computations?
  7. Is Haskell's unsafePerformIO an impure function?
  8. Related: Is it true that forall a, IO a is
data Effect = Effect {
unsafePerform :: ()
}
data Effect1 a = Effect1 {
unsafePerform1 :: a -> ()
}
effectToEffect1 :: Effect -> Effect1 a
--effectToEffect1 fx = Effect1 (\_ -> unsafePerform fx)
@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]
import Control.Applicative
isA :: a -> Bool
isA = undefined
isB :: a -> Bool
isB = undefined
isC :: a -> Bool
isC = 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