Skip to content

Instantly share code, notes, and snippets.

@emiaj
emiaj / code
Created August 14, 2014 17:49
let isEven :: Number -> Boolean
let isEven 0 = false
let isEven 1 = false
let isEven 2 = true
let isEven n = isEven(n-1)
{
"name": "playground",
"description": "An empty PureScript project.",
"keywords": [
"purescript"
],
"ignore": [
"**/.*",
"bower_components",
"node_modules",
@emiaj
emiaj / bad1.js
Last active August 29, 2015 14:05
dotPsci instructions from "Purescript By Example" Book
dotPsci: ["src/**/*.purs", "bower_components/**/src/**/*.purs"]
// grunt verbose output
/*
Running "dotPsci" task
Running "dotPsci:0" (dotPsci) task
Verifying property dotPsci.0 exists in config...OK
Files: src/Chapter2/Chapter2.purs -> 0
Reading .psci...OK
package tutorial.webapp
import scala.scalajs.js.JSApp
object TutorialApp extends JSApp {
def main(): Unit = {
println("Hello world!")
}
}
case class Car(Brand:String)
val tuple = ("this","is","a","tuple", 19, Car("Ford"))
// iterating over all items
tuple.productIterator.foreach(println)
/*
this
is
a
tuple
// Global jasmine hook to prevent errors when attempt to
// download a localization .json file in test environment.
// Here we are resetting the translate provider to a
// safe state.
// If a test needs to assert for localized texts,
// the test author is free to setup the translate provider
// on isolation by overriding its settings.
// This wont affect other tests because once the test execution
// exits, the translate provider is reset once again to
// a safe state.
app.directive 'enterKey', ($timeout) ->
(scope, elem, attrs) ->
elem.bind 'keydown', (e) ->
if e.keyCode is 13
$timeout ->
scope.$apply attrs.enterKey
, +attrs.enterKeyDelay
object HelloFuturesScala extends App {
import scala.concurrent._
import scala.concurrent.duration._
import ExecutionContext.Implicits.global
def identityFunction(number:Int) = {
Thread.sleep(3000)
number
}
println("Hello Futures Scala")
Gtk-Message: Failed to load module "overlay-scrollbar"
`menu_proxy_module_load': skype-bin: undefined symbol: menu_proxy_module_load
(skype-bin:18177): Gtk-WARNING **: Failed to load type module: (null)
`menu_proxy_module_load': skype-bin: undefined symbol: menu_proxy_module_load
(skype-bin:18177): Gtk-WARNING **: Failed to load type module: (null)
`menu_proxy_module_load': skype-bin: undefined symbol: menu_proxy_module_load
Your overall score for this assignment is 9.58 out of 10.00
The code you submitted did not pass all of our tests: your submission achieved a score of
7.58 out of 8.00 in our tests.
In order to find bugs in your code, we advise to perform the following steps:
- Take a close look at the test output that you can find below: it should point you to
the part of your code that has bugs.
- Run the tests that we provide with the handout on your code.
- The tests we provide do not test your code in depth: they are very incomplete. In order