Skip to content

Instantly share code, notes, and snippets.

View pedrofurla's full-sized avatar

Pedro Furlanetto pedrofurla

View GitHub Profile
list.map( x => {
val y = hardComplexStuff(x)
if( (f(y) && g(y)) === false ) true else false
})
// Why why someone would do the above vs:
list.map{ x =>
val y = hardComplexStuff(x)
@pedrofurla
pedrofurla / gist:0625201fc6b516b7060ce4cfb4b1a72d
Created February 2, 2017 19:58
Haskell Do build failure
haskell-do$ make build-all-osx
cd gui &&\
npm run build &&\
cd ..
> [email protected] build /haskell-do/gui
> pulp build --to dist/compiled.js
* Building project in /haskell-do/gui
psc: No files found using pattern: bower_components/purescript-*/src/**/*.purs
@pedrofurla
pedrofurla / cohesion.md
Last active December 13, 2016 05:26
Coupling vs Cohesion

Quoting Wikipedia: https://en.wikipedia.org/wiki/Cohesion_(computer_science)


In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, cohesion measures the strength of relationship between pieces of functionality within a given module. For example, in highly cohesive systems functionality is strongly related.

Cohesion is an ordinal type of measurement and is usually described as “high cohesion” or “low cohesion”. Modules with high cohesion tend to be preferable, because high cohesion is associated with several desirable traits of software including robustness, reliability, reusability, and understandability. In contrast, low cohesion is associated with undesirable traits such as being difficult to maintain, test, reuse, or even understand.

Cohesion is often contrasted with coupling, a different concept. High cohesion often correlates with loose coupling, and vice versa. The software metrics

In computer programming, cohesion refers to the degree to which the elements of a module belong together.[1] Thus, cohesion measures the strength of relationship between pieces of functionality within a given module. For example, in highly cohesive systems functionality is strongly related.

Cohesion is an ordinal type of measurement and is usually described as “high cohesion” or “low cohesion”. Modules with high cohesion tend to be preferable, because high cohesion is associated with several desirable traits of software including robustness, reliability, reusability, and understandability. In contrast, low cohesion is associated with undesirable traits such as being difficult to maintain, test, reuse, or even understand.

Cohesion is often contrasted with coupling, a different concept. High cohesion often correlates with loose coupling, and vice versa.[citation needed] The software metrics of coupling and cohesion were invented by Larry Constantine in the late 1960s as part of Structured Design, bas

In computer programming, cohesion refers to the degree to which the elements of a module belong together.[1] Thus, cohesion measures the strength of relationship between pieces of functionality within a given module. For example, in highly cohesive systems functionality is strongly related.

Cohesion is an ordinal type of measurement and is usually described as “high cohesion” or “low cohesion”. Modules with high cohesion tend to be preferable, because high cohesion is associated with several desirable traits of software including robustness, reliability, reusability, and understandability. In contrast, low cohesion is associated with undesirable traits such as being difficult to maintain, test, reuse, or even understand.

Cohesion is often contrasted with coupling, a different concept. High cohesion often correlates with loose coupling, and vice versa.[citation needed] The software metrics of coupling and cohesion were invented by Larry Constantine in the late 1960s as part of Structured Design, based

@pedrofurla
pedrofurla / gist:481f2811faed8a728c3f3cc46eb80c4b
Created November 10, 2016 13:01
Some silly lambda calculus
+1 \n.\f.\z.f (n f z)
+2 \n.\f.\z.f (f (n f z))
1 = \f.\z.f z
2 = \f.\z.f ( f z )
+ == \n\m\f\z. n f ( m f z )
@pedrofurla
pedrofurla / git-branches-by-commit-date.sh
Created November 4, 2016 18:59 — forked from jasonrudolph/git-branches-by-commit-date.sh
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40).
Type in expressions for evaluation. Or try :help.
scala> :paste
// Entering paste mode (ctrl-D to finish)
object A {
object B {
def foo: Int = 4
}
@pedrofurla
pedrofurla / IO.scala
Created August 12, 2016 15:40 — forked from jdegoes/IO.scala
A pedagogical implementation of the IO monad in Scala in 14 LOC
case class IO[A](unsafePerformIO: () => A) {
def map[B](ab: A => B): IO[B] = IO(() => ab(unsafePerformIO()))
def flatMap[B](afb: A => IO[B]): IO[B] =IO(() => afb(unsafePerformIO()).unsafePerformIO())
def tryIO(ta: Throwable => A): IO[A] =
IO(() => IO.tryIO(unsafePerformIO()).unsafePerformIO() match {
case Left(t) => ta(t)
case Right(a) => a
})
}
object IO {
@pedrofurla
pedrofurla / tmorris-exercises.scala
Last active July 29, 2016 14:58
Tony Morris' Revised Scala Exercises
sealed trait List[+A] {
override def toString = {
def toScalaList(t: List[A]): scala.List[A] = t match {
case Empty => Nil
case Cons(h, t) => h :: toScalaList(t)
}
toScalaList(this).toString
}
}
final case object Empty extends List[Nothing]