This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import System | |
import System.FilePath.Posix | |
import System.Posix.Files | |
import System.Posix.Types | |
import Directory | |
import Monad | |
import Data.List |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Graphics.Rendering.OpenGL | |
import Graphics.UI.GLUT | |
import Data.IORef | |
import System.Random | |
import System.Exit | |
-- an infinite set of random divergences from 0 | |
trail :: RandomGen g => g -> [GLfloat] | |
trail gen = let rs = randoms gen :: [Bool] | |
in scanl (+) 0 $ map f rs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RubyProf.start | |
wip.ingest! | |
r = RubyProf.stop | |
printer = RubyProf::GraphHtmlPrinter.new r | |
open('/home/franco/profile/ingest.profile.html', 'w') { |io| printer.print io, :min_percent=> 0 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Resolving dependencies... | |
Configuring monads-fd-0.0.0.1... | |
Preprocessing library monads-fd-0.0.0.1... | |
Building monads-fd-0.0.0.1... | |
Control/Monad/Cont.hs:77:7: | |
Could not find module `Control.Monad.Trans': | |
It is a member of the hidden package `transformers-0.1.4.0'. | |
Perhaps you need to add `transformers' to the build-depends in your .cabal file. | |
It is a member of the hidden package `mtl-1.1.0.2'. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stdinHandler :: Snap () | |
stdinHandler = do | |
x <- liftIO $ do | |
putStrLn "snap: " | |
s <- B.getLine | |
return s | |
writeBS x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NoMethodError: undefined method `auto_generate_validations' for SubmittedSip:Class | |
/Library/Ruby/Gems/1.8/gems/dm-core-1.0.0.rc3/lib/dm-core/model/relationship.rb:373:in `method_missing' | |
/Library/Ruby/Gems/1.8/gems/dm-core-1.0.0.rc3/lib/dm-core/model/property.rb:288:in `method_missing' | |
/Library/Ruby/Gems/1.8/gems/dm-validations-1.0.0.rc3/lib/dm-validations.rb:42:in `new' | |
/Library/Ruby/Gems/1.8/gems/dm-core-1.0.0.rc3/lib/dm-core/model/property.rb:84:in `property' | |
/Library/Ruby/Gems/1.8/gems/dm-core-1.0.0.rc3/lib/dm-core/associations/many_to_one.rb:59:in `source_key' | |
/Library/Ruby/Gems/1.8/gems/dm-core-1.0.0.rc3/lib/dm-core.rb:283:in `repository' | |
/Library/Ruby/Gems/1.8/gems/dm-core-1.0.0.rc3/lib/dm-core/repository.rb:114:in `scope' | |
/Library/Ruby/Gems/1.8/gems/dm-core-1.0.0.rc3/lib/dm-core.rb:283:in `repository' | |
/Library/Ruby/Gems/1.8/gems/dm-core-1.0.0.rc3/lib/dm-core/associations/many_to_one.rb:57:in `source_key' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# property :status, Enum[:enqueued, :released_to_workspace], :default => :enqueued | |
/usr/local/lib/ruby/gems/1.8/gems/dm-migrations-1.0.0.rc3/lib/dm-migrations/adapters/dm-do-adapter.rb:92:in `execute_non_query': ERROR: invalid input syntax for integer: "enqueued" (DataObjects::DataError) | |
from /usr/local/lib/ruby/gems/1.8/gems/dm-migrations-1.0.0.rc3/lib/dm-migrations/adapters/dm-do-adapter.rb:92:in `create_model_storage' | |
from /usr/local/lib/ruby/gems/1.8/gems/dm-migrations-1.0.0.rc3/lib/dm-migrations/adapters/dm-do-adapter.rb:90:in `each' | |
from /usr/local/lib/ruby/gems/1.8/gems/dm-migrations-1.0.0.rc3/lib/dm-migrations/adapters/dm-do-adapter.rb:90:in `create_model_storage' | |
from /usr/local/lib/ruby/gems/1.8/gems/dm-do-adapter-1.0.0.rc3/lib/dm-do-adapter/adapter.rb:260:in `with_connection' | |
from /usr/local/lib/ruby/gems/1.8/gems/dm-migrations-1.0.0.rc3/lib/dm-migrations/adapters/dm-do-adapter.rb:85:in `create_model_storage' | |
from /usr/local/lib/ruby/gems/1.8/gems/d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
raise "need a db uri" unless ARGV.first | |
require 'data_mapper' | |
class Foo | |
include DataMapper::Resource | |
property :id, Serial | |
property :bar, Enum[:a, :b, :c], :default => :a | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
include DataMapper::Resource | |
property :id, Serial | |
property :bar, Enum[:a, :b, :c], :default => 2 | |
end | |
f = Foo.new | |
f.save # => false | |
# Bar must be one of a, b, c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newtype State s a = State { runState :: (s -> (a,s)) } | |
instance Monad (State s) where | |
return a = State $ \s -> (a,s) | |
(State x) >>= f = State $ \s -> let (v,s') = x s | |
in runState (f v) s' |