News aggregator

Ideal programming language for a new modern OS built from scratch?

Haskell on Reddit - Fri, 07/04/2014 - 4:35am

I know this is a Haskell forum, but Haskell community tends to be polyglot and fairly open-minded about right tool for right job. I've been thinking about fact that there are only two main OS architectures in personal computing: DOS/Windows line vs Unix line (MacOS/iOS, Linux, Android). What if someone (finally) decided to build a completely new OS from scratch without re-hashing Unix yet again and designing it to meet the needs of modern devices, networks, services, etc. What would be the programming language of choice for a low level 'modern' operating system if restricted to known languages (old or recent) as opposed to also inventing another hypothetical 'ideal' language?

Here are the choices:

  1. Assembly language
  2. C
  3. Lisp variant
  4. Java
  5. Erlang
  6. Golang
  7. Haskell
  8. Javascript (gasp!)
  9. ML variant
  10. Scala
  11. Rust
  12. Logic programming (Prolog, Mercury)
  13. Other (specify)
submitted by RaymondWies
[link] [61 comments]
Categories: Incoming News

Type-level Nat to Integer

haskell-cafe - Thu, 07/03/2014 - 10:03pm
Hi all, I'm trying to change type-level Nat to Integer as following: {-# LANGUAGE DataKinds, KindSignatures, GADTs, PolyKinds #-} data Nat = Z | S Nat class NatToInt n where natToInt :: n -> Int instance NatToInt Z where natToInt _ = 0 instance NatToInt (S n) where natToInt = 1 + natToInt (undefined :: n) I understand why it fails (Z and S have not the right kind). How to specify that NatToInt is Nat-specific? Moreover, if you have any advanced explanations/links which could give me a deeper understanding on what going on, I'll take them. Thanks in advance for your help. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

Final Call for Papers: OCL 2014 Submissions Due in OneWeek

General haskell list - Thu, 07/03/2014 - 4:15pm
(Apologies for duplicates) CALL FOR PAPERS 14th International Workshop on OCL and Textual Modeling Applications and Case Studies (OCL 2014) Co-located with ACM/IEEE 17th International Conference on Model Driven Engineering Languages and Systems (MODELS 2014) September 28-30 (tbc), 2014, VALENCIA, SPAIN http://www.software.imdea.org/OCL2014/ Modeling started out with UML and its precursors as a graphical notation. Such visual representations enable direct intuitive capturing of reality, but some of their features are difficult to formalize and lack the level of precision required to create complete and unambiguous specifications. Limitations of the graphical notations encouraged the development of text-based modeling languages that either integrate with or replace graphical notations for modeling. Typical examples of such languages are OCL, textual MOF, Epsilon, and Alloy. Textual modeling languages have thei
Categories: Incoming News

Final Call for Papers: OCL 2014 Submissions Due inOne Week

haskell-cafe - Thu, 07/03/2014 - 4:15pm
(Apologies for duplicates) CALL FOR PAPERS 14th International Workshop on OCL and Textual Modeling Applications and Case Studies (OCL 2014) Co-located with ACM/IEEE 17th International Conference on Model Driven Engineering Languages and Systems (MODELS 2014) September 28-30 (tbc), 2014, VALENCIA, SPAIN http://www.software.imdea.org/OCL2014/ Modeling started out with UML and its precursors as a graphical notation. Such visual representations enable direct intuitive capturing of reality, but some of their features are difficult to formalize and lack the level of precision required to create complete and unambiguous specifications. Limitations of the graphical notations encouraged the development of text-based modeling languages that either integrate with or replace graphical notations for modeling. Typical examples of such languages are OCL, textual MOF, Epsilon, and Alloy. Textual modeling languages have thei
Categories: Offsite Discussion

Restarting doc build on hackage

haskell-cafe - Thu, 07/03/2014 - 2:55pm
Hi cafe, Does anyone know if there is a way to restart a documentation build on hackage? We have a package where the documentation failed to build due to a dependency lacking upper bounds. That has recently been fixed (using the new in-place cabal file editing feature), and we'd like to get documentation for our package now. Is there any way to do this (apart from uploading a new version without changes)? Erik
Categories: Offsite Discussion

Writing a plugin to save xmonad state?

Haskell on Reddit - Thu, 07/03/2014 - 2:33pm

I've been using the xmonad tiling window manager for a while now, and picked up a bit of Haskell along the way so I could make sense of configuring it. I'm mainly a Python guy, and I enjoyed doing a bit of Clojure not too long ago - I really liked it, but pure functional languages like Haskell are new to me.

I soon came to need one feature that xmonad lacks - namely, being able to save the current state of a workspace, complete with any modifications to the layout state such as resizing and reordering windows. This StackOverflow answer comes pretty close: xmonad already stores and then reloads all of its state when you restart it. I would like to implement this in order to learn some actual Haskell; however, I'm a complete newb at Haskell and I find myself at a complete loss.

I'm thinking of starting out by writing something like a LayoutModifier which responds to a message and writes the underlying layout's state to a file... only I don't understand file IO in Haskell and can't figure out whether the layout state would be in the available scope. Actually, can a LayoutModifier even take a Choice of layouts (which the ||| layout combinator seems to be returning)? Do you nice folks happen to have any pointers?

submitted by egasimus
[link] [4 comments]
Categories: Incoming News

Proposal: New mailing lists -- haskell-jobs &haskell-academia

haskell-cafe - Thu, 07/03/2014 - 2:33pm
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 The proposal is simply as follows. 1. Make a list, haskell-jobs. This would be primarily for job postings and looking-for-job posts. A secondary purpose is discussing jobs. E.g. "Anyone know any jobs in the Foo area?", and meta-discussions like "How well does Haskell jobs pay in your experience?". 2. Make a list, haskell-academia. This would be primarily for studentship postings and call for papers. A secondary purpose is discussing academia. E.g. "Anyone know any unis that use Haskell extensively in the Foo area?", and meta-discussions like "How well is Haskell taught at unis in your experience?" The motivation for this is twofold. 1. We get a lot of job postings and studentship postings. Many of these will be ignored by readers, up until they suddenly find themselves looking for a job or studentship. It would be useful if they could then easily filter their email on lists -- or go to the online archives for that specific list. The latter is a big Win, b
Categories: Offsite Discussion

Haste-perch: for dynamic html

Haskell on Reddit - Thu, 07/03/2014 - 8:15am
Categories: Incoming News

Haskell Weekly News: Issue 298

General haskell list - Thu, 07/03/2014 - 6:59am
Welcome to issue 298 of the HWN, an issue covering crowd-sourced bits of information about Haskell from around the web. This issue covers from June 15 to 28, 2014 Quotes of the Week * Kinnison * imagines a radio station playing only things like 'Life tru a Lens', stuff by 'Dire States' or 'Monadonna' Top Reddit Stories * Today I published an introductory book on Haskell Data Analysis Domain: haskelldata.com, Score: 99, Comments: 26 Original: [1] http://goo.gl/R2kRFu On Reddit: [2] http://goo.gl/Ka0oP5 * Backpack: An ML-like module system for Haskell Domain: plv.mpi-sws.org, Score: 76, Comments: 44 Original: [3] http://goo.gl/7Zkxbg On Reddit: [4] http://goo.gl/78H37f * Cgrep, a context-aware grep for source code. Domain: awgn.github.io, Score: 67, Comments: 13 Original: [5] http://goo.gl/q1VdEA On Reddit: [6] http://goo.gl/2NNTrO * Teenage Haskell Domain: twdkz.wordpress.com, Score: 63, Comments: 7 Original: [7] http://goo.gl/c
Categories: Incoming News

GLUT under Windows using ghc 7.8.2?

haskell-cafe - Thu, 07/03/2014 - 12:31am
It appears that The Haskell Platform includes libglut32.a and other important libs, so it is self-contained, provided users can work with the version of ghc that is provided: currently 7.6.3 under Windows. In particular, 'cabal install glut' works fine with the default version of ghc. But if I try using ghc-7.8.2 I get: Configuring GLUT-2.5.1.1... cabal: Missing dependencies on a foreign library: * Missing C library: glut32 ... All of the following do not change the result: 1. Adding --extra-lib-dirs=c:\glut-3.7.6-bin to the command line. 2. Using freeglut instead of glut 3. Copying libglut.a from The Haskell Package mingw/lib directory to c:\ghc-3.8.2\mingw\lib (dangerous because I am mixing architectures here). How does cabal decide that the C library glut32 is missing? Where is it looking? Why doesn't it look in the places I specify? Thanks, Dominick
Categories: Offsite Discussion

How to deal with dependency bounds for an application

haskell-cafe - Wed, 07/02/2014 - 9:17pm
Hey, I have wrote a little tool and some people had issues installing it with cabal and had to use "--reorder-goals" to be able to install it [1]. Obviously it's because I have very few dependency bounds (actually near none aside base). I don't have to be convince that it's a bad idea, the motivation for adding bounds are pretty clear... but... I'm not sure how to define them? Should I know what is the lowest possible combination of my dependencies who would compile... because if I'm too strict it might be difficult for some user to install? or maybe I should target as lowest what is in current haskell-platform? I'm looking for some advice and feedback from maintainers. Thanks in advance! [1]: https://github.com/aloiscochard/codex/issues/6
Categories: Offsite Discussion

Making the Haskell 2010 report latex repo

haskell-cafe - Wed, 07/02/2014 - 9:14pm
The Haskell 2010 report is here: http://darcs.haskell.org/haskell2010-report Also mirrored in git here: git< at >github.com:hvr/haskell2010-report.git This version doesn't build because it uses old "Char" instead of "Data.Char"-style imports. So my version here: https://github.com/chrisdone/haskell2010-report Fixes that: https://github.com/chrisdone/haskell2010-report/commit/6a773abb7201f4854ba5173227da28bf868747e5 But that's as far as I get. Here is what happens when I run $ cd tools; make; cd .. $ cd report; make I get: http://lpaste.net/raw/5699097250156773376 As is typical in the LaTeX, a torrent of uninteresting information is spewed out. Finally, at the end, it says: Does anyone familiar with the language of LaTeX have any idea what's going on? Has anyone successfully been able to build it? If so, please state the exact steps to do so and I will be very grateful. Ciao!
Categories: Offsite Discussion

Problem with type in a function

haskell-cafe - Wed, 07/02/2014 - 8:52pm
Hi, I have the following function plotf :: Ploteable a => ([a] -> IO ()) -> (a -> a) -> [a] -> IO () plotf plot fn xs = plot $ map fn xs that compiles correctly, but when I use it with: plotf win sin [1..100::Double] -- where win :: [Double] -> IO () I'm geting the error: No instance for (Ploteable Double) arising from a use of ‘plotf’ In the expression: plotf win sin [1 .. 100 :: Double] In an equation for ‘it’: it = plotf win sin [1 .. 100 :: Double] What am I missing? Thanks! 50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964 http://cujae.edu.cu
Categories: Offsite Discussion

How to store complex values with Persistent

Haskell on Reddit - Wed, 07/02/2014 - 5:50pm

I'm trying to store a record with a field of type [Text] using Yesod/Persistent. This (fairly old) blog post mentions in the section labelled "Complex Data Structures Support!" that Persistent now supports entities with such fields, but I can't figure out how to actually do that. I get errors when I try the obvious thing (i.e., just declaring an entity with a field of type [Text]). Does anyone know how to do this?

Edit: The plot thickens:

When I give my entity a field questions :: [Text] and start the development server, I get an SQL error:

Migrating: CREATE TEMP TABLE "user_backup"("id" INTEGER PRIMARY KEY,"ident" VARCHAR NOT NULL,"password" VARCHAR NULL,"questions" VARCHAR NOT NULL,CONSTRAINT "unique_user" UNIQUE ("ident")) Migrating: INSERT INTO "user_backup"("id","ident","password") SELECT "id","ident","password" FROM "user" devel.hs: user error (SQLite3 returned ErrorConstraint while attempting to perform step.)

Second edit:

I deleted my database and Yesod created a new one which works, but is this avoidable?

submitted by seriousreddit
[link] [3 comments]
Categories: Incoming News

Why does GHC always box polymorphic fields in datastructures?

Haskell on Reddit - Wed, 07/02/2014 - 3:20pm

Hello /haskell/, I was reading Johan Tibbe's talk on GHC performance and one thing baffled me, and I quote:

Polymorphic fields are always stored as pointer-to-thing, which increases memory usage and decreases cache locality. Compare:

data Tree a = Leaf | Bin a !(Tree a) !(Tree a) data IntTree = IntLeaf | IntBin {-# UNPACK #-} !Int !IntTree !IntTree

Specialized data types can be faster, but at the cost of code duplication. Benchmark your code and only use them if really needed.

It turns out that Haskell's polymorphic types are not a zero-cost abstraction, and it would be perfectly normal in a unityped language where generics can only be implemented through runtime checks, but can't Haskell do better than that? After all, GHC has type inference, it knows the types of everything at compile time, it can infer typeclass instances at compile time, making typeclass methods zero-overhead, etc. So seeing that a Tree Int for some reason cannot be represented the same as an IntTree is... baffling. Is there a fundamental reason for that, or is it just a wart peculiar to GHC?

P.S. I'm in no way saying that the performance cost is terrible or that we should all stop using parametric polymorphism, I'm just baffled as to possible reasons for this strange decision.

Thank you.

submitted by aicubierre
[link] [29 comments]
Categories: Incoming News

PhD studentship on interval computation in Haskell

General haskell list - Wed, 07/02/2014 - 11:50am
------------------------------------------------- PhD studentship - Interval Computation in Haskell ------------------------------------------------- * Applicants should have a strong background in real analysis and functional programming. * The closing date for applications is 18th July 2014. * The project will be supervised by Michal Konečný, Aston University. * The student will receive a 3-year studentship of £15,500/year. * UK/EU student's fee is covered, non-EU student's fee is £10,914 in 2014/2015. * The student will act as a teaching assistant for a distance learning course approx. 7h/week. * For more information, use the following links: o Description of the potential project topics[1] o AERN - a Haskell interval computation library[2] o Supervisor's home page[3] o Department research home page[4] o Details of the studentship and links to application forms[5] (The above advert is also available at http:/
Categories: Incoming News

How to get good performance when processing binary data with conduit + vector/bytestring?

Haskell on Reddit - Wed, 07/02/2014 - 10:53am

I've been playing around with some data compression algorithms. Basically, code that loads some data from disk and then transforms, analyzes, shuffles around, compresses etc. I thought conduits and vector / bytestring would be a natural representation for those algorithms in the Haskell world, but I'm having a very hard time producing code that is elegant and fast.

Conduit seems to have a very large overhead that makes yielding individual words between stages unacceptably slow. Here:

runResourceT $ CB.sourceFile "test.dat" =$ CC.concat $$ CL.fold (+) 0

Just adding up all the bytes in a file, basically. That already takes like .5s/MB, which is pretty horrendous. It seems clear that the way to get decent performance is to always await / yield some chunk of data.

The first issue I have with this is that it renders many useful combinators unusable. For instance, I was hoping to use the conduitVector combinator to turn the input file into 1MB chunks of vector data for a blocksorting transform, but that seems impractical knowing how conduit performs with streams of singular Word8s.

Further, I struggle with actually outputting those bytestring chunks. Imagine a conduit performing some transformation, like run length coding or huffman compression. You read data from the input, and sometimes write a byte or more to the output. Just a buffer that fills till we can yield a sizeable chunk.

Haskell, to my knowledge, lacks a structure like an std::vector with amortized O(1) append and the compact storage of an array. We could either use a mutable vector for the chunk and progressively fill it, but then we're faced with the problem of efficiently converting a vector back into a bytestring. While possible, it's a bit of a low-level mess and there is no direct support for it.

There are no mutable / growing bytestrings (sure, I know why), and the best construct we have seems to be a bytestring builder. It seems fairly wasteful to build up mconcat'enated chunks of builders, but I gave that a shot. Neither brief, nor simple, but here is what I came up with:

type OutputBS = (Int, Int, BB.Builder) emptyOutputBS :: Int -> OutputBS emptyOutputBS chunkSize = (chunkSize, 0, mempty) outputByte :: Monad m => Word8 -> OutputBS -> forall i. ConduitM i B.ByteString m OutputBS outputByte w8 obs@(chunkSize, numBytes, _) | numBytes >= chunkSize = flushOutputBS obs >> addW8 (emptyOutputBS chunkSize) | otherwise = addW8 obs where addW8 (chunkSize', numBytes', builder') = return (chunkSize', numBytes' + 1, builder' <> BB.word8 w8) flushOutputBS :: Monad m => OutputBS -> forall i. ConduitM i B.ByteString m () flushOutputBS (_, numBytes, builder) | numBytes > 0 = yield (BL.toStrict $ BB.toLazyByteString builder) | otherwise = return () processAndChunkOutput :: Monad m => Conduit B.ByteString m B.ByteString processAndChunkOutput = flip evalStateT (emptyOutputBS 65536) loop where loop = (lift await) >>= \case Nothing -> get >>= lift . flushOutputBS Just bs -> do forM_ [0..B.length bs - 1] $ \i -> outputByteState (bs `B.index` i) loop outputByteState w8 = get >>= (\obs -> lift $ outputByte w8 obs) >>= put

This works as expected, but the performance is also at .5s/MB. Replacing the builder with a simple list that's reversed before being packed into a bytestring in the end is ~40% or so faster, but still too slow.

Looking further down the road for my compression code, I see more potential issues with this approach. Like if I want to use repa for a wavelet transform or FFT or so at a stage, again having to convert between vector and bytestring.

Can anybody recommend a way to speed up this conduit pipeline? Do you think this is in general a sound way of structuring the input, output, analysis and transformation stages of a compression program?

Thanks!

submitted by SirRockALot1
[link] [30 comments]
Categories: Incoming News

Closed type families, apartness, and occurs check

glasgow-user - Wed, 07/02/2014 - 9:19am
From the user manual, it sounds like a clause of a closed type family should be rejected once no subsitution of the type could make it unify with the clause. If so, it doesn't seem to do an occurs check: type family IsEq a b :: Bool where   IsEq a a = True   IsEq a b = False forall a . IsEq a a :: Bool = forall (a :: k). 'True forall a . IsEq a [a] :: Bool = forall a. IsEq a [a] I came across this while trying to using Generics to find the immediate children of a term - this sort of non-reduction happens while comparing a type like (Term var) with a constructor argument of type var. Brandon _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users< at >haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Categories: Offsite Discussion

Help installing GHC

Haskell on Reddit - Wed, 07/02/2014 - 8:29am

I'm having a problem installing GHC on my device running Apple ARM Darwin (it's a jailbroken device). I already have gcc (compiler) so I was hoping to build a version of ghc for device.

When I do 'distrib/hc-build' I get an error saying can't workout build platform.

Does anybody know how to fix this or install ghc on ARM Darwin?

http://i.imgur.com/obl031r.jpg

submitted by H1DD3NT3CH
[link] [6 comments]
Categories: Incoming News