# News aggregator

### Is there any generic zipper class that works for any traversable free monad?

Since a free monad encapsules a tree structure, is there a generic zipper that works for any traversable free monad? For example:

tree :: Free [] Int tree = Free [ Free [ Free [Pure 1, Pure 2], Free [Pure 3, Pure 4]], Pure 5, Pure 6, Free [Pure 7,Pure 8,Pure 9]] a = root tree b = goDown 0 a c = goDown 1 b d = goDown 1 c e = view d main = print eNot exactly that, but you get the idea...

submitted by SrPeixinho[link] [6 comments]

### HDBC installation error

### Alternatives convert products to sums

### How much math do I need to know to learn Haskell?

I'm looking to expand my horizons away from OOP, and I've heard that Haskell is one of the better languages to learn if you want to understand functional programming.

So far so good, but as I start to read about Haskell, I immediately get the impression that I need to understand a lot of high level math concepts.. To be honest, I haven't done math in ages, and I never managed to pass my Calculus class but I've been doing very well with OOP. However when I look at Haskell online I see terms like the Howard-Curry Equivalence, functors, Kleisli Arrows, beta reduction, Church numerals, Category theory, etc etc, terms that I honestly haven't ever heard of before and whenever I google them I get to something that seems like it's very complicated and needs a lot of math..

So how much math do I need to know to learn Haskell? It seems like a very cool language but I am not very good with maths.

submitted by Enfeathered[link] [27 comments]

### Tips for finding out what module originates a symbol?

Hi,

I'm learning Haskell and it's going well but there's one thing where I feel really stupid, but can't find any good info on how to do better: How do I find out which module imports a symbol when I don't have ghci?

E.g. I'm reading http://www.haskellforall.com/2014/04/model-view-controller-haskell-style.html which uses Single. I can't find Single in hoogle or hayoo so look at all the modules' docs on hackage until I find the symbol [1]. That seems very inefficient .. how do other people solve this?

[1] Single is from https://hackage.haskell.org/package/pipes-concurrency-2.0.1/docs/Pipes-Concurrent.html

submitted by realteh[link] [12 comments]

### Question about making API with Lens compatibility

Hello all

I am trying to make an API for working with persisted records. I would very much like to provide a lens-style interface for reads and updates but I'm not sure if it is possible. Given (contrived but only an example):

data City = City { _cName :: String, _cState :: String } data Person = Person { _pName :: String , _pAge :: Int, _pCity :: City }I would like to provide a function "update" that takes a lens-like thing to perform the update (to both the record and the persisted data). The key point with this function is I would like the lens-like thing to compose multiple updates but only at one level. I.e.

update (pName "Santa Claus" . pAge 65) personbut not

update (pName "Santa Claus" . (pCity . cName "North Pole City")) personAs well there would be a function "select" for retrieving values out of the records. This would take a lens-like thing but it *could* get nested values, as in:

The above can be considered pseudo code as I doubt select can look like this. But the main thing I wanted to know was if lenses can actually update multiple fields at once, select multiple fields at once and if I can restrict the level the operations work on and still stay compatible with the interface.

Also, note that there would be another operation "modify" that update would be based on (and possibly select, but I don't see how give that select is not as restricted).

submitted by nicheComicsProject[link] [10 comments]

### JP Moresmau: Writing a low level graph database

I found that in general literature is quite succinct on how database products manage their physical storage, so I've used some of the ideas behind the Neo4J database, as explained in the Graph Databases books and in a few slideshows online.

So I've written the start of a very low level graph database, writing directly on disk via Handles and some Binary instances. I try to use fixed length record so that their IDs translate easily into offsets in the file. Mostly everything ends up looking like linked lists on disk: vertices have a pointer to their first property and their first edge, and in turn these have pointers to the next property or edge. Vertex have pointers to edges linking to and from them.

I've also had some fun trying to implement an index trie on disk.

All in all, it's quite fun, even though I realize my implementations are quite naive, and I just hope that the OS disk caching is enough to make performance acceptable. I've written a small benchmark using the Hackage graph of packages as sample data, but I would need to write the same with a relational backend.

If anybody is interested in looking at the code or even participate, everything is of course on Github!

### mth

### mth

### Unacceptable argument type in foreign declaration:Ptr ()

### CIS 194

### CIS 194

### Question about composing Applicatives

I've heard it said (for example, here) that one of the advantages of Applicatives over Monads is that they compose. But I haven't seen a CompositeApplicative type or anything like that.

I'm imagining something like this:

newtype CompositeApplicative a1 a2 b = CompositeApplicative (a1 (a2 b)) instance (Applicative a1, Applicative a2) => Functor (CompositeApplicative a1 a2) where fmap f (CompositeApplicative ca) = CompositeApplicative (fmap (fmap f) ca) instance (Applicative a1, Applicative a2) => Applicative (CompositeApplicative a1 a2) where pure b = CompositeApplicative (pure (pure b)) CompositeApplicative ca1 <*> CompositeApplicative ca2 = CompositeApplicative (pure (<*>) <*> ca1 <*> ca2) type MaybeIO = CompositeApplicative Maybe IODoes that already exist in some standard library somewhere? If not, why not? Like, what's the standard technique for making *use* of the fact that Applicatives compose?

[link] [3 comments]