Openings for brilliant Haskell devs for excitingproject "as close to a space station as you can get" < at >Swedish spinoff, DSLs/safety-critical/embedded software, and more
I've checked and triple-checked the environment variables and tried the all the suggested flags. The header is there, the libs are there, and nothing complains except cabal itself. Any suggestions?submitted by tejon
[link] [3 comments]
ECOOP 2014 paper (distinguished) by Vaziri et. al, abstract:
Continuous data streams are ubiquitous and represent such a high volume of data that they cannot be stored to disk, yet it is often crucial for them to be analyzed in real-time. Stream processing is a programming paradigm that processes these immediately, and enables continuous analytics. Our objective is to make it easier for analysts, with little programming experience, to develop continuous analytics applications directly. We propose enhancing a spreadsheet, a pervasive tool, to obtain a programming platform for stream processing. We present the design and implementation of an enhanced spreadsheet that enables visualizing live streams, live programming to compute new streams, and exporting computations to be run on a server where they can be shared with other users, and persisted beyond the life of the spreadsheet. We formalize our core language, and present case studies that cover a range of stream processing applications.
Summary: The Safe library now has exact versions of take/drop, with twelve functions implemented on top of a generalised splitAt.
The Safe library is a simple Haskell library that provides versions of standard Prelude and Data.List functions that usually throw errors (e.g. tail), but wrapped to provide better error messages (e.g. tailNote), default values (e.g. tailDef) and Maybe results (e.g. tailMay).
I recently released version 0.3.5, which provides a new module Safe.Exact containing crashing versions of functions such as zip/zipWith (which error if the lists are not equal length) and take/drop/splitAt (which error if there are not enough elements), then wraps them to provide safe variants. As an example, the library provides:takeExact :: Int -> [a] -> [a]
takeExactMay :: Int -> [a] -> Maybe [a]
These are like take, but if the Int is larger than the length of the list it will throw an error or return Nothing. Some sample evaluations:takeExactMay 2 [1,2,3] == Just [1,2]
takeExact 2 [1,2,3] == [1,2]
takeExactMay 2  == Nothing
takeExact 2  ==
1:error "Safe.Exact.takeExact, index too large, index=2, length=1"
take 1 (takeExact 2 ) == 
So takeExactMay computes up-front whether the whole computation will succeed, and returns a Nothing if it will fail. In contrast, takeExact produces elements while they are present, but if you demand an additional element that is missing it will result in an error. All the exceptions in the Safe library are designed to provide the maximum level of detail about what went wrong, here telling us the index we were after and the length of the list.
The library provides takeExact, dropExact and splitAtExact, plus Def/May/Note versions, resulting in twelve similar functions. While the implementation of any one function is reasonably short (although not that short, once proper error messages are provided), I didn't want to write the same code twelve times. However, generalising over functions that check up-front and those that check on-demand requires a bit of thought. In the end I settled for:splitAtExact_ :: (String -> r) -> ([a] -> r) -> (a -> r -> r) -> Int -> [a] -> r
splitAtExact_ err nil cons o xs
| o < 0 = err $ "index must not be negative, index=" ++ show o
| otherwise = f o xs
f 0 xs = nil xs
f i (x:xs) = x `cons` f (i-1) xs
f i  = err $
"index too large, index=" ++ show o ++ ", length=" ++ show (o-i)
Here the splitAtExact_ function has a parameterised return type r, along with three functional arguments that construct and consume the r values. The functional arguments are:
- err :: String -> r, says how to convert an error into a result value. For up-front checks this produces a Nothing, for on-demand checks this calls error.
- nil :: [a] -> r, says what to do once we have consumed the full number of elements. For take we discard all the remaining elements, for drop we are only interested in the remaining elements.
- cons :: a -> r -> r, says how to deal with one element before we reach the index. For take this will be (:), but for functions producing a Maybe we have to check the r parameter first.
With this generalisation, I was able to write all twelve variants. As a few examples:addNote fun msg = error $ "Safe.Exact." ++ fun ++ ", " ++ msg
takeExact = splitAtExact_ (addNote "takeExact") (const ) (:)
dropExact = splitAtExact_ (addNote "dropExact") id (flip const)
takeExactMay = splitAtExact_ (const Nothing) (const $ Just ) (\a -> fmap (a:))
dropExactMay = splitAtExact_ (const Nothing) Just (flip const)
splitAtExact = splitAtExact_ (addNote "splitAtExact")
(\x -> (, x)) (\a b -> first (a:) b)
splitAtExactMay = splitAtExact_ (const Nothing)
(\x -> Just (, x)) (\a b -> fmap (first (a:)) b)
Normally I would have defined takeExact and dropExact in terms of fst/snd on top of splitAtExact. However, in the Safe library error messages are of paramount importance, so I go to additional effort to ensure the error says takeExact and not splitAtExact.
Title mostly says it all. I'm doing some data work at my job, and since we're a python shop we're using mostly pandas and numpy. They're great at what they do, but I would love to be able to do at least some of the same things in Haskell. It seems like making something like a pandas DataFrame would be possible in Haskell, and be quite useful. What are the best libraries for manipulating and operating on large matrices in Haskell, with efficient implementations of high-level tasks like time series, merge/join/groupby, parsing CSV and XLS, etc?submitted by saikyou
[link] [26 comments]
If a functor a categorical homomorphism on objectes such as Maybe, then why do we call Maybe a Functor? Shouldn't fmap be the functor and the Maybe type constructor be the Category?
Forgive me if this is a stupid question, i'm reading "learn you a haskell". Thank you.submitted by yyttr3
[link] [13 comments]
Haskell Sublime Text integration requires hdevtools.
hdevtools won't build right on Windows (requires unix, and even with MSYS it throws an unqualified error building that -- granted I haven't yet tried cygwin) which is fixed by this fork.
That fork fails to build with the newly-release Platform 2014 because it requires process==1.1.* and process is now at 22.214.171.124, with previous versions not installed.
Attempting to install process-126.96.36.199 fails because Not in scope: 'unsafePerformIO'.
Changing the requirement on the windows hdevtools fork to process==1.2.* allows me to configure, then gives me this on build:src\Info.hs:130:59: Not in scope: data constructor `GHC.MatchGroup' Perhaps you meant `GHC.DocGroup' (imported from GHC) src\Info.hs:164:5: Not in scope: `Pretty.showDocWith' Perhaps you meant `Pretty.showDoc' (imported from Pretty) src\Info.hs:229:12: Not in scope: type constructor or class `PprTyThing.PrintExplicitForalls'
And the combination of my knowledge and Haskell documentation accessibility do not yet stack up to the task of hacking this out. :) Any pointers?submitted by tejon
[link] [7 comments]
I've spent the last couple months tinkering on a client for Strava's API. I ended up using http-conduit for making requests, aeson for decoding JSON, and a lens-based interface for manipulating records. I'd love some feedback about the decisions I've made and the code I wrote. In particular, I'd like some feedback about:
- Template Haskell. It cleaned up my code, but the TH code I wrote is gross. I don't yet know enough to make it better. (See issue #69 for details.)
- Template Haskell again. Is it recommended to use something like zeroth to avoid a compile-time dependency on TH? (See issue 76 for details.)
- Internals. Should I export stuff in the Strive.Internal module?
Thanks in advance for any input!
- Introductory post: http://taylor.fausak.me/2014/08/11/strive-a-haskell-client-for-the-strava-api/
- Source code: https://github.com/tfausak/strive/tree/v0.6.1
- Package page: http://hackage.haskell.org/package/strive-0.6.1
[link] [3 comments]