GithubHelp home page GithubHelp logo

cassava-conduit's Introduction

Dom De Re

About

👋 Hi, I’m @domdere, a Game Developer and avid Functional Programmer based in Sydney, Australia.

I run a small game dev studio in Sydney called 👉Irreverent Pixel Feats 👈.

We're working on our first commercial title, but also try and produce small free games during Game Jams and whatnot, as well as providing work-for-hire for other developers working on bigger projects.

Games I've Been Involved In

Socials and Sites

cassava-conduit's People

Contributors

domdere avatar jchia avatar jonathanlking avatar naushadh avatar profpatsch avatar ryanglscott avatar typetetris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cassava-conduit's Issues

Uploading to Stackage?

Hi! Thanks for the great package, it's been very useful to me! :D Just wondering if there any plans to put cassava-conduit onto the stackage package database?

(If you wanted to, it's as simple as editing this file)

Adding a header variant of toCsv

Thanks for this package, its super useful.

I want to add a new method to allow streaming out to a CSV file using a header, but I am strugglig to build the project with Mafia.

I think the code should be pretty simple:

toNamedCsv :: (Monad m, ToNamedRecord a) => Header -> EncodeOptions -> ConduitT a BS.ByteString m ()
toNamedCsv header opts = {-# SCC toCsv_p #-} map $ BSL.toStrict . encodeWithName header opts . pure

Anyway, let me know if something like this would be accepted and I'll persevere setting up mafia 😅

Benchmark build failure (Critereon.Types does not export Pure)

Preprocessing library cassava-conduit-0.3.2...
Preprocessing benchmark 'benchmarks' for cassava-conduit-0.3.2...
[1 of 1] Compiling Main             ( benchmarks/Main.hs, dist/build/benchmarks/benchmarks-tmp/Main.o )

benchmarks/Main.hs:10:26: error:
    Module ‘Criterion.Types’ does not export ‘Pure’

Here's one way to reproduce:

$ stack unpack cassava-conduit-0.3.2 && cd cassava-conduit-0.3.2
$ stack init --resolver nightly-2016-07-19
$ stack bench

toNamedCsv

Great library, thanks for developing and maintaining it!

One weak point, though, is writing .csv files back to the file system. Probably you didn't need this functionality for your use-case. To my understanding at the moment cassava-conduit only includes a very basic toCsv function:

toCsv :: (Monad m, ToRecord a) => EncodeOptions -> ConduitT a BS.ByteString m ()
toCsv opts = {-# SCC toCsv_p #-} map $ BSL.toStrict . encodeWith opts . pure

with a comment indicating that this was more of an afterthought: "Streams from csv to text, does not create headers...".

I would like to know if it would be possible to add a function toNamedCsv, which makes use of the ToNamedRecord class in cassava to automatically write with column names. This is important functionality for my application. Are there special challenges involved with this or was it just not a priority for you so far?

I saw that there is an alternative with the csv-conduit library, which seems to have this functionality. But of course I would prefer to stay with cassava, which I understand already, over a completely different library.

Add headers variant redux

I have a source that doesn't support being treated like a filehandle, nor does it support being updated after "writing the file" so to speak.

I noticed discussion in #28 about using multiple producers and slightly modified some code from there:

toNamedDefaultOrderCsv :: (Monad m, ToNamedRecord a, DefaultOrdered a) => EncodeOptions -> ConduitT a BS.ByteString m ()  
toNamedDefaultOrderCsv opts = {-# SCC toCsv_p #-} map $ BSL.toStrict . encodeDefaultOrderedByNameWith opts . pure  

The problem is this prints a header per line which I think you allude to in one of your longer comments on #28.

So then... I think I'll be perfectly fine if I can just specify a string to be prepended before all other lines and saw your comment about multiple producers. I came up with this:

runConduit $ sequenceSources [ yieldMany [ Left ()], yieldMany [ Right "a", Right "b" ]]
  .|  concat
  .| (awaitForever $ \x ->
         case x of Left () ->
                     liftIO (putStrLn "hi")
                     Right _ -> yield x)
  .| printC

This only prints out:

hi
Right "a"

I can of course use an IORef to do this, but I'd prefer to make the multiple sources approach work. I think it would be a good addition here as well.

containers-0.6.7

Sorry but why a new release with tighter containers bound?
This prevents building in Stackage nightly:

containers-0.6.7 (changelog) is out of bounds for:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.