[Haskell-cafe] Request for code review: slice-1.0.0, TestSupport

Owen Smith ods94065 at gmail.com
Mon Nov 24 06:12:14 EST 2008

Hi all,

Thanks for your welcome and helpful comments. I've banged out a first
attempt at a Haskell library and was curious if anybody would have
time or interest in looking it over it for style, design, stuff that's
just wrong, or (most likely) stuff that's been done better elsewhere.
I'm willing to trade some labor in kind, if there's any odd jobs that
can be done by a relative newbie (e.g. maybe setting up a Windows box
for OpenGL build testing with GHC 6.10??).

The library, slice, is an emulation of Python's list slicing mechanism:


It uses a triple of Maybes to specify the range, so it's unwieldly in
terms of syntax, but the functionality should be there. Mostly,
besides gaining experience with writing a library, I wanted to have
functionality that skips through a list the way Python slices can, and
didn't see a particularly clean way of doing that particular kind of
list dicing in Data.List or elsewhere. (In particular, looking towards
an application where I'll need to split a list into odd-positioned
elements and even-positioned-elements.) I'm doubtful if this is worth
publishing as a real package, but maybe someone besides myself will
see something in it worth keeping.

One thing I did play with was hooking my unit tests into the Cabal
build system for my package; if I've read earlier posts correctly this
has not been done frequently or systematically, so if that's the case,
maybe this can be a contribution towards better testing support. The
scripts in the TestSupport module follow a pattern I've used elsewhere
in other languages: stomp through the Test directory hierarchy, find
all source files that start with Test, and run them on the fly using
runhaskell. This works beautifully if you happen to have runhaskell
installed and on your system path, but woe to you if you don't--and
I'm not sure how to properly capture that as a dependency in Cabal.
I'm also wondering if there's any existing Cabal support to configure
a proper location for this (I couldn't find it). And if that weren't
enough--if similar mechanisms to runhaskell exist for other compilers
that I should try to build into this somehow.

-- O

More information about the Haskell-Cafe mailing list