News aggregator
foldable flexible bridges (putting foldable+traversable in prelude)Re: Burning bridges
Super KISS web framework: scotty
ICSM 2013 - CFP for ERA/Tool Demo/DoctoralSymposium/Industry Tracks
ghc-mod v2.0.1
Haskell Platform 2013.2.0.0 Windows installer RC1
Failure deriving MonadRWS when using a type-family for the State part
wren ng thornton: Upcoming talk
Next month I'll be giving a talk at the NLCS workshop, on the chiastic lambda-calculi I first presented at NASSLLI 2010 (slides[1]). After working out some of the metatheory for one of my quals, I gave more recent talks at our local PL Wonks and CLingDing seminars (slides). The NASSLLI talk was more about the linguistic motivations and the general idea, whereas the PLWonks/CLingDing talks were more about the formal properties of the calculus itself. For NLCS I hope to combine these threads a bit better— which has always been the challenge with this work.
NLCS is collocated with this year's LICS (and MFPS and CSF). I'll also be around for LICS itself, and in town for MFPS though probably not attending. So if you're around, feel free to stop by and chat.
[1] N.B., the NASSLLI syntax is a bit different than the newer version: square brackets were used instead of angle brackets (the latter were chosen because they typeset better in general); juxtaposition was just juxtaposition rather than being made explicit; and the left- vs right-chiastic distinction was called chi vs ksi (however, it turns out that ksi already has an important meaning in type theory).
comments
Zippers, Comonads, and Data Structures in Scala (slides by T. Morris and M. Hibberd)
Stuck on design problem
nightly builds: empty directory
New Functional Programming Job Opportunities
Where can I find some great Haskell tutorials for those who know some functional programming concepts before?
I have been learning ML in my functional programming course. However, in the final project my lecture asked us to contribute to an open source Haskell project he has chosen. So I need to learn Haskell very quickly. Can you recommend some Haskell tutorials suitable for me? Thanks!
submitted by beltsazar[link] [8 comments]
rip in the class-abstraction continuum
language-puppet: Incoming: Ruby bridge
I am working on a quick and dirty Ruby bridge library, that I hope will yield a huge performance gain with template interpolation in the language-puppet library. Right now, it is capable of:
- Initializing a Ruby interpreter from libruby
- Calling Ruby methods and functions
- Registering methods or functions that will be called from Ruby code
- Converting data between the two Worlds (right now the most complex instance is the JSON one, which means that many complex Ruby types can’t be converted, but it is more than enough for passing data)
- Embedding native Haskell values that can be passed around in Ruby to the Haskell-provided external functions (I will use this for passing the Puppet catalog state around)
There are still a few things to do before releasing it :
- Making compilation a bit less dependant on the system. This will probably require quite a few flags in the cabal definition …
- Hunting for memory leaks. I am not sure how to do this with the GHC Runtime in the middle, and I do hope that ruby_finalize frees everything that is managed by the Ruby runtime. After all, restarting processes seems to be the only working garbage collection method for Ruby daemons …
- Writing stubs for the Puppet library methods that might be needed by templates. I would like to be able to support custom types and functions directly written in Ruby instead of Lua, but this will probably turn into a nightmare …
- Cleaning things up !
Here is a quick code preview :
<figure class="code"><figcaption>test.hs </figcaption> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 {-# LANGUAGE OverloadedStrings, OverloadedStrings #-} module Main where import Foreign.Ruby.Bindings import Data.Aeson import Data.Attoparsec.Number -- this is an external function that will be executed from the Ruby interpreter -- the first parameter to the function is probably some reference to some top object -- my knowledge of ruby is close to nonexistent, so I can't say for sure ... extfunc :: RValue -> RValue -> IO RValue extfunc _ v = do -- deserialize the Ruby value into some JSON Value onv <- fromRuby v :: IO (Maybe Value) -- and display it print onv -- now let's create a JSON object containing all kind of data types let nv = object [ ("bigint" , Number (I 16518656116889898998656112323135664684684)) , ("int", Number (I 12)) , ("double", Number (D 0.123)) , ("null", "Null") , ("string", String "string") , ("true", Bool True) , ("false", Bool False) , ("array", toJSON ([1,2,3,4,5] :: [Int])) , ("object", object [ ("k", String "v") ] ) ] -- turn it into Ruby values, and return this toRuby nv -- this is the function that is called if everything was loaded properly nextThings :: IO () nextThings = do -- turn the extfunc function into something that can be called by the Ruby interpreter myfunc <- mkRegistered2 extfunc -- and bind it to the global 'hsfunction' function rb_define_global_function "hsfunction" myfunc 1 -- now call a method in the Ruby interpreter o <- safeMethodCall "MyClass" "testfunc" [] case o of Right v -> (fromRuby v :: IO (Maybe Value)) >>= print Left r -> putStrLn r main :: IO () main = do -- initialize stuff ruby_init ruby_init_loadpath -- and load "test.rb" s <- rb_load_protect "test.rb" 0 if s == 0 then nextThings else showError >>= putStrLn </figure>And here is the ruby program, that calls our external function :
<figure class="code"><figcaption>test.rb </figcaption> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 class MyClass def self.testfunc hsfunction( [16588, "qsqsd", true, { 'a' => 'b' }, :symbol, 0.432, 5611561561186918918918618789115616591891198189123165165889 ] ).each do |k,v| puts "#{k} => #{v} [#{v.class}]" end 12 end end </figure>And the output, showing that data is properly converted from either sides :
<figure class="code">1 2 3 4 5 6 7 8 9 10 11 Just (Array (fromList [Number 16588,String "qsqsd",Bool True,Object fromList [("a",String "b")],String "symbol",Number 0.432,Number 5611561561186918918918618789115616591891198189123165165889])) bigint => 16518656116889898998656112323135664684684 [Bignum] int => 12 [Fixnum] double => 0.123 [Float] array => 12345 [Array] true => true [TrueClass] null => Null [String] string => string [String] object => kv [Hash] false => false [FalseClass] Just (Number 12)</figure>EDIT: added link to the code.