Отправлено с iPhone
17.11.2012, в 11:19, damodar kulkarni kdamodar2...@gmail.com написал(а):
In the second case, why the GHC doesn't give something like?
([Char] (a - t), Num a) = t
Because Num is a class of types, while String is a type.
In other words, in the expression 3 a ghc doesn't
Just another definition of calculateSeq:
calculateSeq = zipWith ($) (cycle [sin,cos]) . map sqrt
This is just slightly slower than my implementation.
I came up with a better implementation of parallel function:
calculatePar2 :: [Double] - [Double]
calculatePar2 xss = runEval $
concat
Given a list of numbers of fixed length I need to list all possible
values (and the associated computation) you get by
inserting +,-,*,/ between the numbers, and also set parentheses where
you please.
It shouldn't list computations with unnecessary parentheses.
Example list of length 3 [a,b,c] and
All,
I've been working on a server implementation of an existing networking
protocol. The protocol uses magic constants in some places (e.g. to
tag message types), as well as bitfields, or a combination of both
packed in a single value.
I created data types for both the identifiers as well as
Hi Nicolas,
The simplest approach would be to use the standard (derived) Enum
instance that would be used for enumerations (like [Flag1..]), and
have your own functions to convert to/from magic constants.
Roman
* Nicolas Trangez nico...@incubaid.com [2012-11-17 15:44:57+0100]
All,
I've been
Hello everyone,
I was wondering if you could help me!
So, I have a typeclass Action which defines method run:
class Action a where
run :: a - Int
and two data types that are instances of this typeclass:
data A = A Int
deriving (Read, Show)
instance Action A where
run (A n) =
This smells like homework to me,
which isn't a bad thing,
it will however change the way I answer you.
Please look at http://hackage.haskell.org/packages/archive/base/latest/doc/
html/Data-List.html#v:permutations
and show us your attempts to use this function.
Timothy
-- Původní
On Sat, 2012-11-17 at 16:52 +0200, Roman Cheplyaka wrote:
Hi Nicolas,
The simplest approach would be to use the standard (derived) Enum
instance that would be used for enumerations (like [Flag1..]), and
have your own functions to convert to/from magic constants.
Sure, but that kind-of
Nicolas Trangez nico...@incubaid.com writes:
On Sat, 2012-11-17 at 16:52 +0200, Roman Cheplyaka wrote:
Hi Nicolas,
The simplest approach would be to use the standard (derived) Enum
instance that would be used for enumerations (like [Flag1..]), and
have your own functions to convert to/from
On Sat, 2012-11-17 at 16:27 +0100, Herbert Valerio Riedel wrote:
what do you hope to gain from making your flags type an instance of
the
Enum class?
Among others, the ability to list all flags using [Flag1 ..]
How is this handled for libraries wrapping C libs which use some bitset
structure?
* Nicolas Trangez nico...@incubaid.com [2012-11-17 16:23:28+0100]
On Sat, 2012-11-17 at 16:52 +0200, Roman Cheplyaka wrote:
Hi Nicolas,
The simplest approach would be to use the standard (derived) Enum
instance that would be used for enumerations (like [Flag1..]), and
have your own
Apologies for any duplicates:
CALL FOR PARTICIPATION
SIGPLAN Programming Languages Mentoring Workshop, Rome
Tuesday January 22, 2013
Co-located with POPL 2013
PLMW web page: http://www.doc.ic.ac.uk/~gds/PLMW/index.html
After the resounding success of the first Programming Languages
It might be rare that a real world problem can be formulated as such
a simple mathematical challenge,
so I can't blame you for thinking about home work. I did too.
Actually it's part of a logic puzzle I'm implementing.
Attacking the problem textually, I can treat the list of infix
operators as
Instead of attacking the problem textually, try to create a datatype which
would describe your expressions, then generate all values of this
datatype, filter those you don’t need, and convert the rest into Strings.
Currently your expressions are represented by “String” — conversion is
very
Sorry! I replied without reading your message properly.
I could then work directly with parsing trees, and generate all binary
trees of fixed lengths.
But most of them would be unnecessary, so it seems like I'm attacking
it from the wrong angle.
They won’t be unnecessary if you generate them
On 09/11/2012 18:35, Clark Gaebel wrote:
I think we just use dependencies different things. This is a problem
inherent in cabal.
When I (and others) specify a dependency, I'm saying My package will
work with these packages. I promise.
When you (and others) specify a dependency, you're
The following algorithm generates all possible expressions and throws away
most
of unnecessary duplicates.
import qualified Data.Map as M
data Expr = Num Int
| Add Expr Expr
| Sub Expr Expr
| Mul Expr Expr
| Div Expr Expr
Rendering function is
Indentation messed up… I have pasted the code here: http://hpaste.org/77864
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Being concrete, all you can do is:
parseAction :: String - Either A B
parseAction str
| (A `isPrefixOf` str = Left $ read str
| (B `isPrefixOf` str = Right $ read str
parseAction :: String - Int
parseAction str
| (A `isPrefixOf` str = run $ (read str :: A)
| (B `isPrefixOf`
Hey Stephen,
Thank you for the reply!
Can you elaborate on how I can use existentials?
I always up for learning new (Haskell) stuff :)
Cheers,
José
On 18-11-2012 00:19, Stephen Tetley wrote:
Being concrete, all you can do is:
parseAction :: String - Either A B
parseAction str
| (A
Replying somewhere random in the thread.
Linux distributions have to solve this same problem. We first need to
decide what Hackage's function is supposed to be:
(1) A dumb repository to host Haskell code
(2) A collection of Haskell packages that work together
In reality it's (1), but the
Dear Janek,
I am reading Simon Marlow's tutorial on parallelism and I have problems
with correctly using Eval monad and Strategies. I *thought* I understand
them but after writing some code it turns out that obviously I don't
because parallelized code is about 20 times slower. Here's a short
On 12-11-17 02:19 AM, damodar kulkarni wrote:
Let's see tthis:
Prelude :t 3 a
3 a :: (Num ([Char] - t)) = t
No complaint from GHC; but now see this:
Prelude :t a 3
interactive:1:0:
Couldn't match expected type `t1 - t'
against inferred type `[Char]'
In the expression: a
Hello José,
So, I have a typeclass Action which defines method run:
class Action a where
run :: a - Int
(snipped)
Now, I want to parse either A or B from a String.
I was thinking about something like this...
parseAction :: (Action a, Read a) = String - a
parseAction str
| (A
24 matches
Mail list logo