web developer & system programmer

coder . cl

ramblings and thoughts on programming...

CSDS is comming…

published: 26-09-2012 / updated: 26-09-2012
posted in: development, haskell, programming, projects
by Daniel Molina Wegener

I have started a new project on Haskell. It is called CSDS, or Core Stateful Data Structures. It will hold common functional data structures, mostly based on the implementation described on the book “Purely Functional Data Structures”, but on Haskell I am using type classes and implementing some common interfaces for that kind of data structures. Is very nice to work on project like this, I think that I will use this kind of project on integrations with projects like Cloud Haskell, for distributed processing. For example some of them like the StackLT and QueueLT are providing a class interface to work with the Foldable and Monoid type classes.

Is interesting to see how some interfaces cannot be dually implemented, like PrioQueueLT cannot implement the Foldable type class. I will think a little bit more on those data structures, and still they are not fully stateful, despite they are using single-write and single-read approach. The StackLTClass type class have enough method to allow you some flexible implementations, mainly using StackLT.

class StackLClass t where
    type SLT t
    emptyS :: t
    isEmptyS :: t -> Bool
    pushS :: SLT t -> t -> t
    popS :: t -> (SLT t, t)
    lengthS :: t -> Int
    reverseS :: t -> t
    fromListS :: [SLT t] -> t
    toListS :: t -> [SLT t]
    stackLTSize :: t -> Int
    stackLTList :: t -> [SLT t]
    sortS :: (Ord (SLT t)) => t -> t
    foldlS :: (t -> SLT t -> t) -> t -> t
    mapConcatS :: (SLT t -> SLT t) -> [t] -> t
    singletonS :: SLT t -> t

If you can see the type class structure, it have some method that should allow you to work with distributed and parallel processing using Cloud Haskell and the Par Monad. I think that you will be able to work on several problems with this library. As usual I am using static checkers among other tools to ensure the quality of the code and I am coding constructs that are almost entirely compatible with Agda, so this library will be come a formally verified library of stateful data structures.

Also I will implement Typeable type class on almost all structures, this will allow you to identify network streams of data with serialized Haskell constructs, mainly where the type is not clearly defined and the processing functions or type classes are using type variables. The main goal is to use a very flexible approach, but as much strict that Haskell and Agda can handle. You are invited to participate on the development of this project at github.

No coments yet.

post a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>