Sha256: add1b608d5a0baf097d89c3ecf1823873017b39a617be99c8195d3e8a5769736
Contents?: true
Size: 764 Bytes
Versions: 3
Compression:
Stored size: 764 Bytes
Contents
module Wrappers where import Hubris data RValue = T_FIXNUM Int | T_STRING String | T_NIL | T_BIGNUM Integer deriving (Eq, Show,Ord) wrap :: (Haskellable a, Rubyable b) => (a->b) -> (RValue -> RValue) wrap func ar = case (toHaskell ar) of Just a -> toRuby $ func a Nothing -> T_NIL class Haskellable a where toHaskell :: RValue -> Maybe a class Rubyable a where toRuby :: a -> RValue instance Haskellable Int where toHaskell (T_FIXNUM i) = Just i toHaskell _ = Nothing instance Rubyable Int where toRuby i = T_FIXNUM i instance Haskellable Integer where toHaskell (T_BIGNUM i) = Just i toHaskell _ = Nothing instance Rubyable Integer where toRuby i = T_BIGNUM i
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hubris-0.0.6 | Haskell/Language/Ruby/Wrappers.hs |
hubris-0.0.5 | Haskell/Language/Ruby/Wrappers.hs |
hubris-0.0.4 | Haskell/Language/Ruby/Wrappers.hs |