Would someone familiar with the command-line-parsing libraries care to help
Krassimir?
Thanks
Simon
-Original Message-
From: Krassimir Krustev [mailto:[EMAIL PROTECTED]
Sent: 23 December 2007 11:38
To: Simon Peyton-Jones
Subject: Treating command-line arguments as a Haskell expression
While reading the Haskell language report I noticed that function type is
not an instance of class Read.
I was told that one cannot define them as an instance of class Show
without breaking referential transparency or printing a constant.
f :: (a-b)-String
f x = bla bla bla
How can I
Cristian Baboi wrote:
While reading the Haskell language report I noticed that function type
is not an instance of class Read.
I was told that one cannot define them as an instance of class Show
without breaking referential transparency or printing a constant.
f :: (a-b)-String
f x =
| data (Ord a) = BST a = Empty | BST (BST a) a (BST a)
|
| Experience has taught me to _never_ put class contexts on data
| definitions.
Correct. Haskell-98 contexts on data-type declarations are a mis-feature of
Haskell, which I resisted at the time but failed to eliminate.
As others have
2007/12/24, Simon Peyton-Jones [EMAIL PROTECTED]:
Would someone familiar with the command-line-parsing libraries care to help
Krassimir?
AFAIU Krassimir's needs, hs-plugins will help him (function eval).
--
WBR,
Max Vasin
JID: [EMAIL PROTECTED]
On Sun, 2007-12-23 at 11:52 +, Ian Lynagh wrote:
On Thu, Dec 20, 2007 at 10:58:17AM +, Malcolm Wallace wrote:
Nobench does already collect code size, but does not yet display it in
the results table. I specifically want to collect compile time as well.
Not sure what the best way
On Sat, Dec 22, 2007 at 05:25:26PM +0300, Miguel Mitrofanov wrote:
That's not C.
That's the C preprocessor, which is a textual substitution macro
language.
Well, the preprocessor is part of the language in a way. These two come
together.
No. In fact, these are even two different programs,
It is true, however, that preprocessing used to be (in pre-standard
days) separate from the language. This has not been true for decades.
Well, I've seen cpp to be used as a preprocessor not for C sources but for
something else.
___
Haskell-Cafe
On Dec 23, 2007 12:44 PM, Isaac Dupree [EMAIL PROTECTED] wrote:
-- this should work too
parseHeader3 :: BS.ByteString - Maybe (Int, Int)
--note accurate type signature, which helps us use Maybe failure-monad,
--although losing your separate error messages
Oh gee, I just noticed that my type
On Dec 24, 2007 11:55 AM, Paulo J. Matos [EMAIL PROTECTED] wrote:
On Dec 23, 2007 12:44 PM, Isaac Dupree [EMAIL PROTECTED] wrote:
-- this should work too
parseHeader3 :: BS.ByteString - Maybe (Int, Int)
--note accurate type signature, which helps us use Maybe failure-monad,
--although
2007/12/24, Paulo J. Matos [EMAIL PROTECTED]:
On Dec 24, 2007 11:55 AM, Paulo J. Matos [EMAIL PROTECTED] wrote:
On Dec 23, 2007 12:44 PM, Isaac Dupree [EMAIL PROTECTED] wrote:
-- this should work too
parseHeader3 :: BS.ByteString - Maybe (Int, Int)
--note accurate type signature,
On Mon, 24 Dec 2007 11:27:11 +0200, apfelmus [EMAIL PROTECTED]
wrote:
Cristian Baboi wrote:
How can I define a function to do the inverse operation ?
g :: String - ( a - b )
This time I cannot see how referential transparency will deny it.
What's the excuse now ?
The new excuse is
2007/12/24, Cristian Baboi [EMAIL PROTECTED]:
On Mon, 24 Dec 2007 11:27:11 +0200, apfelmus [EMAIL PROTECTED]
wrote:
Cristian Baboi wrote:
How can I define a function to do the inverse operation ?
g :: String - ( a - b )
This time I cannot see how referential transparency will deny
Simon Peyton-Jones:
Would someone familiar with the command-line-parsing libraries
care to help Krassimir?
I agree with Max that it looks like the problem is
not doing any fancy command-line parsing
(if that is indeed the issue, then please post more
information about what the problem is).
On Mon, Dec 24, 2007 at 02:12:30PM +0300, Miguel Mitrofanov wrote:
It is true, however, that preprocessing used to be (in pre-standard
days) separate from the language. This has not been true for decades.
Well, I've seen cpp to be used as a preprocessor not for C sources but for
As the previous answers show, hooking dynamic evaluation, or a subset
thereof, into Haskell is not a particularly easy task. If this is
just a program to get up-and-running with understanding Haskell,
probably best not to delve into this sorts of stuff? A simpler
solution, albeit one which
Hi
I want to call a function from within Haskell module so that the name
of this function corresponds to my first command-line argument and the
rest rest of the command-line arguments are would become themselves
the argument to this function.
While you can do this, you probably don't
Paulo J. Matos wrote:
On Dec 23, 2007 12:44 PM, Isaac Dupree [EMAIL PROTECTED] wrote:
-- this should work too
parseHeader3 :: BS.ByteString - Maybe (Int, Int)
--note accurate type signature, which helps us use Maybe failure-monad,
--although losing your separate error messages
Oh gee, I just
On Dec 24, 2007, at 13:18 , Isaac Dupree wrote:
Paulo J. Matos wrote:
On Dec 23, 2007 12:44 PM, Isaac Dupree [EMAIL PROTECTED]
wrote:
parseHeader3 bs = do
(x, rest) - BS.readInt $ BS.dropWhile (not . isDigit) bs
(y, _) - BS.readInt $ BS.dropWhile (not . isDigit) rest
return (x, y)
{- compile with ghc --make stm.hs -}
module Main where
import Control.Concurrent.STM
type Account = TVar Int
withdraw :: Account - Int - STM ()
withdraw acc amount = do
bal - readTVar acc
writeTVar acc (bal - amount)
main = do
account - atomically $ newTVar 100
atomically $
Brandon S. Allbery KF8NH wrote:
On Dec 24, 2007, at 13:18 , Isaac Dupree wrote:
Paulo J. Matos wrote:
On Dec 23, 2007 12:44 PM, Isaac Dupree [EMAIL PROTECTED] wrote:
parseHeader3 bs = do
(x, rest) - BS.readInt $ BS.dropWhile (not . isDigit) bs
(y, _) - BS.readInt $ BS.dropWhile (not .
To clean up even more, use StateT B.ByteString Maybe. Then the ByteString
threading will be invisible, leading to just liftM2 (,) readI readI, for
suitably defined readI.
On Dec 23, 2007 6:45 AM, Bryan O'Sullivan [EMAIL PROTECTED] wrote:
Paulo J. Matos wrote:
I guess the latter is the
Colleagues!
The essence of trouble may be given by code:
[haskell]
module TypeTrouble where
class FirstClass a where
firstFunction :: (SecondClass b) = a - b
class SecondClass a where
secondFunction :: a - Double
data FirstData = FirstData Double
data SecondData = SecondData Double
On Tue, Dec 25, 2007 at 08:11:34AM +0300, Konstantin Vladimirov wrote:
[haskell]
module TypeTrouble where
class FirstClass a where
firstFunction :: (SecondClass b) = a - b
class SecondClass a where
secondFunction :: a - Double
[/haskell]
I need, the firstFunction of
On Dec 25, 2007 12:11 AM, Konstantin Vladimirov
[EMAIL PROTECTED] wrote:
class FirstClass a where
firstFunction :: (SecondClass b) = a - b
snip!
instance FirstClass FirstData where
firstFunction (FirstData d) = SecondData d
The problem is that the type of firstFunction as producing
25 matches
Mail list logo