mcfilib / ruby-marshal Goto Github PK
View Code? Open in Web Editor NEWHaskell library to parse a subset of Ruby objects serialised with Marshal.dump
License: MIT License
Haskell library to parse a subset of Ruby objects serialised with Marshal.dump
License: MIT License
While constructing the build plan, the following exceptions were encountered:
In the dependencies for ruby-marshal-0.1.1:
cereal-0.5.1.0 must match >=0.4.0 && <=0.5.0 (latest applicable is 0.4.1.1)
vector-0.11.0.0 must match >=0.10.0 && <=0.11.0 (latest applicable is 0.10.12.3)
needed due to authservice-0.1.0.0 -> ruby-marshal-0.1.1
Authservice is a private repo. I will try to provide more details soon on what is causing this conflict
Currently only raw strings are supported.
Appending is slow for large Ruby arrays.
src/Data/Ruby/Marshal/Get.hs:57:7:
Can't find interface-file declaration for data constructor NilChar
Probable cause: bug in .hi-boot file, or inconsistent .hi file
Use -ddump-if-trace to get an idea of which file caused the error
In the pattern: NilChar
In a case alternative: NilChar -> return RNil
In the second argument of ‘(>>=)’, namely
‘\case {
NilChar -> return RNil
TrueChar -> return $ RBool True
FalseChar -> return $ RBool False
FixnumChar -> RFixnum <$> getFixnum
FloatChar -> RFloat <$> getFloat
StringChar -> RString <$> getString
SymbolChar -> RSymbol <$> getSymbol
ObjectLinkChar -> RIVar <$> getObjectLink
SymlinkChar -> RSymbol <$> getSymlink
ArrayChar -> RArray <$> getArray go
HashChar -> RHash <$> getHash go go
IVarChar -> RIVar <$> getIVar go
_ -> return Unsupported }’
Haddock coverage:
100% ( 13 / 13) in 'Data.Ruby.Marshal.Int'
100% ( 5 / 5) in 'Data.Ruby.Marshal.Encoding'
19% ( 3 / 16) in 'Data.Ruby.Marshal.RubyObject'
100% ( 9 / 9) in 'Data.Ruby.Marshal.Monad'
Warning: Not found in environment: Data.Ruby.Marshal.Types.NilChar
Warning: Not found in environment: Data.Ruby.Marshal.Types.FalseChar
Warning: Not found in environment: Data.Ruby.Marshal.Types.TrueChar
Warning: Not found in environment: Data.Ruby.Marshal.Types.ArrayChar
Warning: Not found in environment: Data.Ruby.Marshal.Types.FixnumChar
Warning: Not found in environment: Data.Ruby.Marshal.Types.FloatChar
Warning: Not found in environment: Data.Ruby.Marshal.Types.HashChar
Warning: Not found in environment: Data.Ruby.Marshal.Types.IVarChar
Warning: Not found in environment: Data.Ruby.Marshal.Types.ObjectLinkChar
Warning: Not found in environment: Data.Ruby.Marshal.Types.StringChar
Warning: Not found in environment: Data.Ruby.Marshal.Types.SymbolChar
Warning: Not found in environment: Data.Ruby.Marshal.Types.SymlinkChar
Under a GHC new enough that the MonadFail
split is complete, the library fails to compile Data.Ruby.Marshal.Get
:
ruby-marshal > /run/user/1000/stack-bc4132fd6e708d1d/ruby-marshal-0.1.3/src/Data/Ruby/Marshal/Get.hs:122:20: error:
ruby-marshal > • No instance for (MonadFail Marshal) arising from a use of ‘fail’
ruby-marshal > • In the expression: fail "expected single character"
ruby-marshal > In a stmt of a 'do' block:
ruby-marshal > if | len /= 1 -> fail "expected single character"
ruby-marshal > | otherwise
ruby-marshal > -> do symbol <- g
ruby-marshal > denote <- g
ruby-marshal > ....
ruby-marshal > In the second argument of ‘($)’, namely
ruby-marshal > ‘do str <- g
ruby-marshal > len <- getFixnum
ruby-marshal > if | len /= 1 -> fail "expected single character"
ruby-marshal > | otherwise -> do ...’
ruby-marshal > |
ruby-marshal > 122 | if | len /= 1 -> fail "expected single character"
ruby-marshal > | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ruby-marshal >
I've found that this works properly on my work machine which has a different version of GHC, Cabal and Haddock.
[filib@benbecula:~/Projects/ruby-marshal on master]
% ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.4
[filib@benbecula:~/Projects/ruby-marshal on master]
% cabal --version
cabal-install version 1.22.6.0
using version 1.22.4.0 of the Cabal library
[filib@benbecula:~/Projects/ruby-marshal on master]
% haddock --version
Haddock version 2.14.3, (c) Simon Marlow 2006
Ported to use the GHC API by David Waern 2006-2008
[filib@colonsay:~/Projects/ruby-marshal on issue-49]
% ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.10.1
[filib@colonsay:~/Projects/ruby-marshal on issue-49]
% cabal --version
cabal-install version 1.22.2.0
using version 1.22.2.0 of the Cabal library
[filib@colonsay:~/Projects/ruby-marshal on issue-49]
% haddock --version
Haddock version 2.16.0, (c) Simon Marlow 2006
Ported to use the GHC API by David Waern 2006-2008
We're exposing a bunch of parser combinators that require us to lift a Get into the Marshal monad. It sort of makes sense to expose it.
When a symbol is repeated multiple times, the Marshal encoding allows subsequent instances to reference the first instance to save space in the stream.
irb(main):010:0> Marshal.dump([:x, :x]).bytes
=> [4, 8, 91, 7, 58, 6, 120, 59, 0]
In the above example, the last two values of the array are the symlink. 59
identifies that the object is a symlink and 0
is the index of the symbol cache where we should lookup our object.
Depends on #3.
decodeEither
[source].fromEitherToMaybe
[source].https://www.reddit.com/r/haskell/comments/3enysr/my_first_haskell_project_a_ruby_marshal_parser/
This is because the string encoding isn't thrown away.
Try and have a go at doing this in the same way that msgpack-haskell does. Consumers might need to use FlexibleContexts.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.