Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  Cabal issues (Anand Patil)
   2. Re:  Cabal issues (Stephen Tetley)
   3. Re: [Haskell-cafe] Re: [Haskell-beginners] Accounting Engine
      in        Haskell (Max Cantor)
   4.  Extract and integer from a ByteString (Tom Hobbs)
   5. Re:  Extract and integer from a ByteString (Stephen Tetley)
   6. Re:  Extract and integer from a ByteString (Stephen Tetley)
   7.  Re: solutions (Heinrich Apfelmus)


----------------------------------------------------------------------

Message: 1
Date: Tue, 15 Jun 2010 18:23:18 +0100
From: Anand Patil <anand.prabhakar.pa...@gmail.com>
Subject: [Haskell-beginners] Cabal issues
To: beginners@haskell.org
Message-ID:
        <aanlktil_lx9szdzsbvuwayxtl3rwgc8cfbmn_roxg...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi all,

I'm trying to install hmatrix-static using Cabal. I installed the Haskell
Platform for Mac yesterday from hackage.haskell.org/platform. I've been
having build problems, and one of them is with haskell-src-exts. The output
of cabal install haskell-src-exts -v ends in:

Building haskell-src-exts-1.9.0...
Building library...
Creating dist/build (and its parents)
/usr/bin/ghc --make -package-name haskell-src-exts-1.9.0 -hide-all-packages
-fbuilding-cabal-package -i -idist/build -isrc -idist/build/autogen
-Idist/build/autogen -Idist/build -optP-DBASE4 -optP-include
-optPdist/build/autogen/cabal_macros.h -odir dist/build -hidir dist/build
-stubdir dist/build -package-id
array-0.3.0.0-307c95c424058c7b6bd041b809e52ef3 -package-id
base-4.2.0.0-0120a3650a6376da8d1b6a4e48a2973a -package-id
cpphs-1.11-20b9349b60ba9e187ce20bacef8124a5 -package-id
pretty-1.0.1.1-2bfa34c699efff7eed4d6297a2dac12d -O Language.Haskell.Exts
Language.Haskell.Exts.Parser Language.Haskell.Exts.Pretty
Language.Haskell.Exts.Syntax Language.Haskell.Exts.Extension
Language.Haskell.Exts.Build Language.Haskell.Exts.Fixity
Language.Haskell.Exts.Comments Language.Haskell.Exts.SrcLoc
Language.Haskell.Exts.Annotated Language.Haskell.Exts.Annotated.Syntax
Language.Haskell.Exts.Annotated.Fixity Language.Haskell.Exts.Annotated.Build
Language.Haskell.Exts.Annotated.ExactPrint
Language.Haskell.Exts.Annotated.Simplify Language.Haskell.Exts.ExtScheme
Language.Haskell.Exts.ParseMonad Language.Haskell.Exts.ParseSyntax
Language.Haskell.Exts.Lexer Language.Haskell.Exts.ParseUtils
Language.Haskell.Exts.InternalParser
<command line>: cannot satisfy -package-id
cpphs-1.11-20b9349b60ba9e187ce20bacef8124a5:
    cpphs-1.11-20b9349b60ba9e187ce20bacef8124a5 is unusable due to missing
or recursive dependencies:
      haskell98-1.0.1.1-0fdaf3b26bc38c43ce8371edf538dbf6
    (use -v for more information)
cabal: Error: some packages failed to install:
haskell-src-exts-1.9.0 failed during the building phase. The exception was:
ExitFailure 1

However, cabal install cpphs --reinstall works fine. Any help getting past
this would be much appreciated.

Thanks,
Anand
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20100615/9d257eab/attachment-0001.html

------------------------------

Message: 2
Date: Tue, 15 Jun 2010 18:55:48 +0100
From: Stephen Tetley <stephen.tet...@gmail.com>
Subject: Re: [Haskell-beginners] Cabal issues
To: Anand Patil <anand.prabhakar.pa...@gmail.com>
Cc: beginners@haskell.org
Message-ID:
        <aanlktinbhmrf3esd1cbqj9luqr5b9arysv6xi6exz...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hello Anand

As a last resort you should be able to get haskell-src-exts to work
via a manual install:

Download the tar.gz from Hackage.

> tar xvfz haskell-src-exts-1.9.0.tar.gz
> cd haskell-src-exts-1.9.0

> runhaskell Setup.hs configure
> runhaskell Setup.hs build
> runhaskell Setup.hs install
> runhaskell Setup.hs haddock

The * install * step may require super-user privileges depending on
your set up...
> sudo runhaskell Setup.hs install


Best wishes

Stephen


------------------------------

Message: 3
Date: Tue, 15 Jun 2010 23:29:20 +0800
From: Max Cantor <mxcan...@gmail.com>
Subject: Re: [Haskell-cafe] Re: [Haskell-beginners] Accounting Engine
        in      Haskell
To: g...@sefer.org
Cc: beginners@haskell.org, haskell Cafe <haskell-c...@haskell.org>
Message-ID: <587dc9c9-3863-4bf8-a9b1-a51b82190...@gmail.com>
Content-Type: text/plain; charset=us-ascii

I think Haskell would be an excellent choice.  

Several reasons come to mind:

Given the arbitrary complexity of such projects, an EDSL describing book 
entries etc would be a very good fit for the project.  As people have said once 
or twice, Haskell is a great fit for EDSLs
 
If you want to get ambitious and scale this up to a multithreaded, multiuser 
environment, STM would be a very good concurrency model.  This pretty much just 
leaves Haskell or Clojure.

Finally, the type system of haskell is hugely useful to this project.  Jane 
Street Capital (ocaml users and damned good at it) has a programming motto: 
make illegal transactions unrepresentative.  The type systems of Haskell and 
OCaml let you structure this kind of project in a way to catch most of your 
bugs at compile time.

So, I think Haskell is the perfect intersection of EDSL support, Concurrency, 
and powerful, static typing for the project.

Good luck, keep us informed of your progress.

Max
 

On Jun 15, 2010, at 5:34 PM, Yitzchak Gale wrote:

> Hi Amir,
> 
> Amiruddin Nagri wrote:
>> My current project is about making an accounting engine...
> 
> Take a look at the related but different project "hledger".
> 
> http://hackage.haskell.org/package/hledger
> http://hackage.haskell.org/package/hledger-lib
> 
>> consistency, handling large data(performance) and
>> availability...
>> I am interested in knowing if Haskell will be the right fit
>> for my project.
> 
> These things can certainly be achieved, and Haskell is
> a great platform for it. Reliability and assurance of correctness
> are very important for financial systems, and Haskell is
> especially good at providing them together with good
> performance.
> 
> However, keep in mind that you are undertaking a very
> ambitious project. There are a lot of little design decisions
> to be made along the way which, if made without a lot of
> previous experience in whatever language you are using,
> could lead to serious problems later on in a large system
> like this.
> 
> I recommend:
> 
> o Start with a less ambitious version of the project -
>  a simpler prototype with less requirements, or components
>  that can be developed as a stand-alone and later integrated
>  into your larger system.
> 
> o Work closely with the community, on the #haskell
>  IRC channel and the Haskell Cafe mailing list, to get
>  guidance from experienced Haskellers. Share and discuss
>  your code as you go along.
> 
> (Or, if you select a different language that you are not
> very experienced in for developing large high-assurance
> commercial systems, do the same with that language's
> community.)
> 
>> Also there has been some concerns because of lazy evaluation
>> in Haskell and memory leaks associated with it.
> 
> The possibility for memory and performance leaks in large
> systems written in Haskell is no more or less than in any
> other mature programming language. As in any language,
> it takes experience and care to avoid them as your application
> scales up.
> 
> Good luck,
> Yitz
> _______________________________________________
> Haskell-Cafe mailing list
> haskell-c...@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



------------------------------

Message: 4
Date: Mon, 14 Jun 2010 22:05:34 +0100
From: Tom Hobbs <tvho...@gmail.com>
Subject: [Haskell-beginners] Extract and integer from a ByteString
To: beginners@haskell.org
Message-ID: <op.vea57jabk73...@localhost.localdomain>
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes

Hi all,

Can anyone help me with this problem I'm been banging my head against for  
a while?

I have a stream of bytes that I want to read, the stream is formatted thus;

null, null, null, 4, 'd', 'a', 't', 'a'<end of stream>

Where the first four bytes tell me the number of bytes I should read next  
in order to get some string value.

What I have is code similar to the following;

readFromStream address port     =
                 do
                 h <- connectTo address (PortNumber port)
                 hSetBuffering h NoBuffering
                 L.hPut h (encode (0xFAB10000 :: Word32))
                 p <- L.hGet h 4
                 readData h (extractInt((L.unpack p)))

extractInt      = foldl addDigit 0
                 where
                 addDigit num d = 10*num + d

readData h c    = do
                 print c
                 s <- L.hGet h c
                 print s

(Note: extractInt is largely copied from a Stack Overflow answer to  
something else.)

The problem with this code in GHCI is;

     Couldn't match expected type `Int' against inferred type `Word8'
     In the second argument of `readData', namely
         `(extractInt ((L.unpack p)))'
     In a stmt of a 'do' expression:
         readData h (extractInt ((L.unpack p)))
     In the expression:
         do { h <- connectTo a (PortNumber p);
              hSetBuffering h NoBuffering;
              L.hPut h (encode (4205903872 :: Word32));
              p <- L.hGet h 8;
              .... }

I read this as saying that readData was expecting an Int, but instead  
extractInt returned it a Word8.  How do I fix extractInt to return an Int  
rather than a Word8?  Or is my problem something else?

Some other things that bother me is my repeating use of 'do'.  How can I  
go about breaking these functions out of being monadic and instead being  
pure?  Is that something I should be striving for, because otherwise I can  
see every function I write here being in a 'do' block.  Also, the final  
line of readFromStream bothers me.  I feel like I'm starting to violate  
some similar form of the Lay of Demeter.  (spelling?)  I don't like  
writing code that looks like "f1 (f2 (f3 (f4 (f5 e))))" even if that is  
what is officially going on, as a programmer I'd rather see named  
variables.  How can I fix that inside of a 'do' block?

Sorry, this is a bit of a brain dump, but I would really appreciate  
someone else's opinion.

Many thanks,

Tom


-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


------------------------------

Message: 5
Date: Tue, 15 Jun 2010 21:15:54 +0100
From: Stephen Tetley <stephen.tet...@gmail.com>
Subject: Re: [Haskell-beginners] Extract and integer from a ByteString
To: Tom Hobbs <tvho...@gmail.com>
Cc: beginners@haskell.org
Message-ID:
        <aanlktiljpte5vhftwjfnhycssr3afcqpwdylwj92e...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi Tom

Try ...

extractInt :: [Word8] -> Int
extractInt = foldl addDigit 0
               where
               addDigit num d = 10*num + (fromIntegral d)


You might find you want to keep your functions monadic, and mostly use
the Get monad from the module Data.Binary.Get for working with binary
data.For instance there is a function getWord32be to do the work that
extractInt is doing

Best wishes

Stephen


------------------------------

Message: 6
Date: Tue, 15 Jun 2010 21:27:10 +0100
From: Stephen Tetley <stephen.tet...@gmail.com>
Subject: Re: [Haskell-beginners] Extract and integer from a ByteString
Cc: beginners@haskell.org
Message-ID:
        <aanlktikilof8vn1pmty_z_e7vphn_rfrmqdf0deuo...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Further,

Data.Binary is distributed with GHC but it isn't always an accessible
module: you can see the module references in Haddock docs distributed
with GHC, but you can't load the modules in your own projects
(certainly on GHC 6.12.2 it is hidden).

If this is the case for the GHC you are using, you have to get and
install "binary" from Hackage.

http://hackage.haskell.org/package/binary

Best wishes

Stephen


------------------------------

Message: 7
Date: Tue, 15 Jun 2010 22:37:07 +0200
From: Heinrich Apfelmus <apfel...@quantentunnel.de>
Subject: [Haskell-beginners] Re: solutions
To: beginners@haskell.org
Message-ID: <hv8o9j$lr...@dough.gmane.org>
Content-Type: text/plain; charset=UTF-8

Andy Larocque wrote:
> I'm working my way thru Simon Thompson's book "The Craft of Functional
> Programming" and would really like to find solutions to the exercises in
> chapters 14,15,16 . I have no idea if any of my own solutions are even
> close. Does anyone have them?

I don't have them, but I'm sure this mailing list will happily supply
you with everything from hints to full solutions if you ask about
specific problems that you're stuck with. In particular, don't forget to
include the problem statements since not everyone has the book. :)

(Also, please keep mentioning that you're a Haskell addict doing
self-studies; we're a bit reluctant to give full solutions to the
occasional other poster that seems to be looking for an easy way around
homework questions that were posed in class. ;))


Regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com



------------------------------

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 24, Issue 16
*****************************************

Reply via email to