- https://github.com/arnarthor/advent-of-code-2017 (Native & BuckleScript)
- https://github.com/rrdelaney/advent-of-code-2017 (Native)
- https://github.com/fazouane-marouane/advent-of-code-2017 (BuckleScript)
- https://github.com/jaredly/advent-2017 (BuckleScript)
- https://github.com/brentbaum/advent-of-code (BuckleScript)
- https://github.com/Lokeh/advent-2017 (BuckleScript)
| {-# LANGUAGE DeriveGeneric #-} | |
| {-# LANGUAGE OverloadedStrings #-} | |
| module Main where | |
| import Data.Foldable (for_) | |
| import Data.Traversable (for) | |
| import Control.Monad.IO.Class | |
| -- build-depends: base, haskeline, optparse-applicative | |
| -- -- for example parser |
| module type Monad = sig | |
| type 'a t | |
| val return: 'a -> 'a t | |
| val bind: 'a t -> ('a -> 'b t) -> 'b t | |
| end |
I had always been confused by Haskell's implementation of existential types. Until now!
Existential types is the algebraic data type (ADT) equivalent to OOP's data encapsulation. It's a way of hiding a type within a type. Hiding it in such a way that any consumer of the data type won't have any knowledge on the internal property
| # Para utilizar el dht11 penseé inicialmente que era necesario WiringPi (no se mucho del tema jajaja). | |
| # Pero tras buscar un poco vi que adafruit tiene una libreria propia (con bindings en Python) y tambien | |
| # existe otra hecha por abyz.co.uk, que se llama pigpio: | |
| http://abyz.co.uk/rpi/pigpio/examples.html#C code | |
| # Aca hay un enlace a SO que esta muy completo: | |
| https://raspberrypi.stackexchange.com/questions/54968/not-able-to-get-sensor-readings-on-am2302 | |
| # Para saber como conectar las cosas, busque un video en youtube, como estos: | |
| https://www.youtube.com/watch?v=IHTnU1T8ETk |
| #!/usr/bin/env stack | |
| {- stack script | |
| --resolver lts-9.1 | |
| --package turtle | |
| --package foldl | |
| --package system-filepath | |
| --package bytestring | |
| --package containers | |
| -} | |
| -- script used to mirror Hackage: https://github.com/AleXoundOS/haskell-stack-mirror-script/issues |
| #!/usr/bin/env stack | |
| {- stack script | |
| --resolver lts-9.1 | |
| --package turtle | |
| --package foldl | |
| --package system-filepath | |
| --package bytestring | |
| --package text | |
| --package containers | |
| -} |
| 13:15 <xQuasar> | HASKELL IS FOR FUCKIN FAGGOTS. YOU'RE ALL A BUNCH OF | |
| | FUCKIN PUSSIES | |
| 13:15 <xQuasar> | JAVASCRIPT FOR LIFE FAGS | |
| 13:16 <luite> | hello | |
| 13:16 <ChongLi> | somebody has a mental illness! | |
| 13:16 <merijn> | Wow...I suddenly see the error of my ways and feel | |
| | compelled to write Node.js! | |
| 13:16 <genisage> | hi | |
| 13:16 <luite> | you might be pleased to learn that you can compile | |
| | haskell to javascript now |
Often when writing programs and functions, one starts off with concrete types that solve the problem at hand. At some later time, due to emerging requirements or observed patterns, or just to improve code readability and reusability, we refactor to make our code more polymorphic. The importance of not breaking your API typically ranges from nice to have (e.g. minimises rework but not essential) to paramount (e.g. in a popular, foundational library).
| (* Good morning everyone, I'm currently learning ocaml for one of my CS class and needed to implement | |
| an avl tree using ocaml. I thought that it would be interesting to go a step further and try | |
| to verify the balance property of the avl tree using the type system. Here's the resulting code | |
| annotated for people new to the ideas of type level programming :) | |
| *) | |
| (* the property we are going to try to verify is that at each node of our tree, the height difference between | |
| the left and the right sub-trees is at most of 1. *) |