[Haskell-cafe] Polymorphic Type Safe URL building -- I need advice on my project
Hello, So I started working on a project involving polymorphic type safe urls. I know there are other type-safe url's out there, but I want some advice before I start reorganizing it. It is located here: https://github.com/dracule/web-scatter One might ask why you would want polymorphic types in your URL. Current implementation of type-safe URLs use a single type and then have it pattern match on the constructors. However, It is a pretty common occurrence that you might want to use a type from other parts of code. Where this becomes prevalent is in IxSet and AcidState. For IxSet your Index keys all have to have separate types . So with this, you can convert your url into your index key's type and then just make your handler like this: myHandler :: BlogId -> SomeWebHandler I know my code probably has some terrible inefficiencies or something, so I am looking for some feedback on some jarring problems. Thank You ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] A new FFMPEG library?
The current hs-ffmpeg library is labeled as "old" on github: https://github.com/anders-/hs-ffmpeg is there a newer one or perhaps an alternative to play media files in haskell? -- Kyle Hanson ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Virthualenv/HsEnv in Windows
Has anyone gotten this to work on Windows either native or on cygwin? Is there an alternative? Happy Holidays, Kyle Hanson ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Default query for AcidState?
I am looking for something with a type signature like this: grabAcidState :: AcidState as -> IO as basically I just want to return my data from database abstractly or based on a class. The reason for this is because I want to have a class instance of state and then I can implement my library like so: data MyCoolData :: MyCoolData T.Text class HasCoolData a where getCoolDataList :: a -> MyCoolData grabStoredList :: HasCoolData as => AcidState as -> IO [MyCoolData] grabStoredList as = do cs <- grabAcidState as return $ getCoolDataList cs and users could implement it like so: data AppState = AppState { someCoolData :: [MyCoolData] } instance HasCoolData AppState { getCoolDataList = someCoolData } However trying to implement this simple behavior has been proving quite difficult. Maybe I am making this too difficult and I should just have a seperate AcidState datatype for my library. Any help would be appreciated. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] MongoDB single insertions super slow
I am trying to write a simple benchmark of testing 1000 single inserts in mongodb, but doing single insertions is super slow. It takes nearly 40 seconds to perform these operations with the haskell mongodb driver, but under a second to perform the same number of operations of single inserts in python. Here are the two files I am working with: https://gist.github.com/hansonkd/6263648 I checked the BSON serialization, and writing it to a socket instead of mongodb driver, makes the script run in under a second so the problem seems to be with the mongodb driver. Any insights would be appreciated. -- Kyle Hanson ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] A question about laziness and performance in document serialization.
So I am not entirely clear on how to optimize for performance for lazy bytestrings. Currently I have a (Lazy) Map that contains large BSON values (more than 1mb when serialized each). I can serialize BSON documents to Lazy ByteStrings using Data.Binary.runPut. I then write this bytestring to a socket using Network.Socket.ByteString.Lazy. My question is this, if the Map object doesn't change (no updates) when it serializes the same document to the socket 2x in a row, does it re-evaluate the whole BSON value and convert it to a bytestring each time? Lets say I wanted to have a cache of bytestings so I have another Map object that has the serialized bytestrings that I populate it with every time the original BSON Map changes. Should the map be strict or lazy? Should the bytestrings it stores be strict or lazy? Any help in understanding laziness would be appreciated. -- Kyle Hanson ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Debugging ByteString and Data.Binary.Get memory usage
OK I have a bunch of BSON documents that I convert to ByteStrings, put in a Map, and write to a socket based on the response. I noticed some high memory usage (in the GBs) so I decided to investigate. I simplified my problem into a small program that demonstrates clearer what is happening. I wrote two versions, one with a Lazy Map and Lazy ByteStrings and one with a Strict Map and Strict ByteStrings. Both share the same memory behavior (except the lazy BS one is faster) Here is the strict version: http://lpaste.net/92298 And here is the lazy version: http://lpaste.net/92299 I wrote this and compared the memory and speed behavior of ByteStrings generated by converting it from a BSON document and ByteStrings generated more purely. The length of the ByteString from a BSON document is 68k and the length of the "pure" BS is 70k. This is my weird memory behavior, both BSON and "pure" methods use the same amount of memory after inserting 10k of them (90mb) However when I go to lookup a value, the BSON Map explodes the memory to over 250mb. Even if I lookup just 1 value. Looking up any number of values in the "pure BS" keeps the memory usage stable (90mb). I am hoping someone can help me understand this. I have read some posts about Temporary ByteStrings causing memory issues but I don't know how to get started debugging. -- Kyle Hanson ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Debugging ByteString and Data.Binary.Get memory usage
Thanks Bob, I made it foldr because it was meant to simulate the sequential IO action that my server uses to populate the Map. I found the problem to be that I need to force the map to evaluate so adding a little $! fixed the problem -- Kyle Hanson On Thu, Aug 29, 2013 at 9:09 PM, Bob Ippolito wrote: > Building a map with foldr seems unwise, have you tried doing it with > fromListWith instead? Or foldl'? In either case, since you don't even put > the map into WHNF, none of the computation is done at all in either case > until the first lookup. > > > On Thu, Aug 29, 2013 at 3:35 PM, Kyle Hanson wrote: > >> OK >> >> I have a bunch of BSON documents that I convert to ByteStrings, put in a >> Map, and write to a socket based on the response. I noticed some high >> memory usage (in the GBs) so I decided to investigate. I simplified my >> problem into a small program that demonstrates clearer what is happening. >> >> I wrote two versions, one with a Lazy Map and Lazy ByteStrings and one >> with a Strict Map and Strict ByteStrings. Both share the same memory >> behavior (except the lazy BS one is faster) >> >> Here is the strict version: >> >> http://lpaste.net/92298 >> >> And here is the lazy version: >> >> http://lpaste.net/92299 >> >> I wrote this and compared the memory and speed behavior of ByteStrings >> generated by converting it from a BSON document and ByteStrings generated >> more purely. >> >> The length of the ByteString from a BSON document is 68k and the length >> of the "pure" BS is 70k. >> >> This is my weird memory behavior, both BSON and "pure" methods use the >> same amount of memory after inserting 10k of them (90mb) >> >> However when I go to lookup a value, the BSON Map explodes the memory to >> over 250mb. Even if I lookup just 1 value. Looking up any number of values >> in the "pure BS" keeps the memory usage stable (90mb). >> >> I am hoping someone can help me understand this. I have read some posts >> about Temporary ByteStrings causing memory issues but I don't know how to >> get started debugging. >> >> -- >> Kyle Hanson >> >> ___ >> Haskell-Cafe mailing list >> Haskell-Cafe@haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell Logo Macbook Decal
I ordered mine! Does anyone know if there is any place where I could order pre-made Haskell t-shirt that benefits haskell.org too? -- Kyle On Tue, Oct 1, 2013 at 10:23 AM, Ryan Trinkle wrote: > Hi everyone, > > I put together a Haskell logo decal designed to fit over the Apple logo on > a MacBook, and had a few made by macdecals.com. They came out great! > They're available here: http://www.macdecals.com/macbook-haskell . My > share of the proceeds will go to haskell.org, and macdecals.com has > generously offered to match that contribution, as well. > > > Ryan > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Minh Thu, please add me to your LinkedIn network
LinkedIn Kyle Hanson requested to add you as a connection on LinkedIn: -- Minh Thu, I'd like to add you to my professional network on LinkedIn. - Kyle Accept invitation from Kyle Hanson http://www.linkedin.com/e/uc6lxc-hlw276p4-5e/XvIdBwmueHfd6vFMPXXdLaqreCbl5oOSpPTFPU/blk/I943132921_20/3wOtCVFbmdxnSVFbm8JrnpKqlZJrmZzbmNJpjRQnOpBtn9QfmhBt71BoSd1p65Lr6lOfP0OnP4Oej8PcjcQekALpQcJlDxQrDwLc3wRcP4Qc3gTdz4LrCBxbOYWrSlI/eml-comm_invm-b-in_ac-inv28/?hs=false&tok=0b7qQjv89PWlU1 View profile of Kyle Hanson http://www.linkedin.com/e/uc6lxc-hlw276p4-5e/rso/60831967/_LLG/name/22724543_I943132921_20/?hs=false&tok=2TI3wCxd1PWlU1 -- You are receiving Invitation emails. This email was intended for Minh Thu Vo. Learn why this is included: http://www.linkedin.com/e/uc6lxc-hlw276p4-5e/plh/http%3A%2F%2Fhelp%2Elinkedin%2Ecom%2Fapp%2Fanswers%2Fdetail%2Fa_id%2F4788/-GXI/?hs=false&tok=0-VFub_99PWlU1 (c) 2012, LinkedIn Corporation. 2029 Stierlin Ct, Mountain View, CA 94043, USA. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe