This is a summary of the "Learn You A Haskell" online book under http://learnyouahaskell.com/chapters.
- Haskell is a functional programming language.
/* jshint expr:true */ | |
/* globals describe, it, beforeEach */ | |
var chai = require( 'chai' ) | |
, expect = chai.expect | |
; | |
var moduleNames = ['lib/recurringDateObjects']; | |
var moduleMethods = []; |
This is a summary of the "Learn You A Haskell" online book under http://learnyouahaskell.com/chapters.
stepReverseSign :: (Fractional a, Ord a) => a -> a -> a | |
stepReverseSign num step = (if num > 0 then -1 else 1) * (abs(num) + step) | |
piCalc :: (Fractional a, Integral b, Ord a) => a -> (a, b) | |
piCalc tolerance = piCalc' 1 0.0 tolerance 0 | |
piCalc' :: (Ord a, Fractional a, Integral b) => a -> a -> a -> b -> (a, b) | |
piCalc' denominator pi tolerance iterations = | |
| abs( pi' - pi) < tolerance = ( pi', iterations ) | |
| otherwise = piCalc' (stepReverseSign denominator) pi' tolerance (iterations + 1) |
wcravens@aberforth:~/Repos/hoas/database$ pg_prove --version | |
pg_prove 3.29 | |
wcravens@aberforth:~/Repos/hoas/database$ ls test/* | |
test/address.sql | |
wcravens@aberforth:~/Repos/hoas/database$ pg_prove -d hoas_test test/*.sql | |
test/address.sql .. ok | |
All tests successful. | |
Files=1, Tests=1, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.03 cusr 0.00 csys = 0.07 CPU) | |
Result: PASS | |
wcravens@aberforth:~/Repos/hoas/database$ pg_prove -d hoas_test test/ |
package MyRole; | |
use Moo; | |
with 'Foo'; | |
1; | |
package main; | |
use Test::More; | |
ok my $foo = MyRole->new( bar => baz ); |
sub set_config { | |
my $self = shift; | |
my $config = My::Config->new; | |
$self->app->log->debug( $config->test ); #yay | |
$self->helper( config => sub { $config } ); | |
$self->log->debug( $self->config->test ); # Can't call method "test" on unblessed reference | |
} |
#!/usr/bin/env perl | |
use Mojolicious::Lite; | |
get '/' => sub { shift->render('test/tab/index') }; | |
app->start; |