Hi,
Fairly new to Haskell and trying some parsec. (Also, new to
parsers/interpreters)
I had come up with this, which works, but I can't help thinking there's
a better way :)
|> newtype Identifier = Identifier String
newtype Literal = StringLiteral String -- to be extended later
data Primar
Tillmann Rendel wrote:
My self-defined monadic combinator of choice to use with parsec is
a >>~ b = a >>= \x -> b >> return x
It works like (>>), but returns the result of the first instead of the
result of the second computation. It is kind of an alternative for
between:
between lpare
Dave Tapley wrote:
I find it's good for the soul to remember what the do notation is
doing for us.
Also I'm with Einstein on "You do not really understand something
unless you can explain it to your grandmother" :)
Personally I think (in this instance) your three 'Parser a' functions
read nic
Hi,
Not sure if this will help avoid the boilerplate, but I've always liked
the approach at
http://leiffrenzel.de/papers/commandline-options-in-haskell.html
(particularly the section "Towards a higher level") for being able to
specify defaults. It's the best resource I've found on command lin
Hi,
Apologies for a long post that may not be totally clear. I was thinking through
a problem and how the data might be represented in Haskell. I'm now stuck and
frustrated. Now, I'm not even sure whether I'm on the right track (I might
still be thinking too OO). Suggestions/ideas would be much a
Al Falloon wrote:
Maybe I am misunderstanding your requirements, but it seems to me that
the simplest solution would be best in this case:
data Widget = BlogWidget [Article]
| TextWidget String
| MenuWiget Menu
| Rows Spacing [Widget]
| Columns Spacing [Widget]
You can also
If I wanted to develop the widgets themselves separately from the
layout, I would probably do something like this:
class Widget a where
render :: a -> Html
bbox :: a -> Size
type Layout = forall a. Widget a => Widget a
| Rows Spacing [Layout]
| Columns Spacing [Layout]
| G
Hi,
I was browsing through the source code for Data.Foldable and having trouble
comprehending it (which was kind of the point of browsing the code, so I could
learn something ;) )
I'm looking at foldl
foldl :: (c -> d -> c) -> c -> t d -> c
foldl f z t = appEndo (getDual (foldMap (Dual . End
Ryan Ingram wrote:
Just expand out the function composition:
Dual . Endo . flip f = (\x -> Dual (Endo (flip f x)))
which has the type d -> Dual (Endo c).
-- ryan
Aha.
I didn't get this straight away, but once I looked at the type signature for
function composition, it became clear.
Hi,
I'm after some help understanding either what I'm doing wrong, or why this error
occurs.
I have a data type:
> data T a = forall b. (Show b) => T b a
and I want to use/extract 'b' from this.
> extShow (T b _) = b
This gives the following compilation error:
extest.hs:5:0:
Inferred
Hi,
I'm was wondering how most people work during when designing a functional
program. Do you create data structures/types first? Do you work from some type
signatures?
For example, take a blog. Is the first step likely to be something like:
data BlogEntry = BlogEntry { title::String,content
Bulat Ziganshin wrote:
Hello Andrew,
Tuesday, November 6, 2007, 10:55:58 PM, you wrote:
for me, abstraction is anything that i want to be an abstraction. i
just write code in the close-to-natural language and it becomes
Haskell program when appropriate syntax applied.
Well, in my experience
Donn Cave wrote:
But in the specific matter I'm wrestling with, the Java library's OOP
model is, to its credit, allowing me to do some things. I'm using their
standard LDAP client library, but swapping in my own function to read
X509 certificates for the SSL. Actually, swapping in my own SSL s
Tim Docker wrote:
levi.stephen wrote:
My concern (which may be inexperience ;) ) is with the monads here
though. What if I hadn't seen that the IO monad (or any other Monad)
was going to be necessary in the type signatures?
You'd have some refactoring to do :-) But actually, it's not possible
Tim Docker wrote:
levi.stephen wrote:
I have similar questions about Haskell abstracting away
implementations behind interfaces as well. I have become
used to an approach where I will not worry about
databases/persistence when beginning. I will create an
interface to a database layer (e.g., save
Hi,
Listed below is my first experiment with reactive programming. It is a
simple web server written using the Data.Reactive[1] library. The
intended interface is given by the runHttpServer function, so the
remainder is intended to be internal.
I'd be happy to hear comments on any parts of t
Hi,
Below is a version that was aimed at getting rid of the (Handle,IO
(Request a)) tuples and as a result made it easier to remove the IO
monad from some types, but I don't think it removed it completely from
any methods.
module Main where
import Control.Applicative
import Control.Concurre
On Thu, Oct 9, 2008 at 9:40 AM, roger peppe <[EMAIL PROTECTED]> wrote:
> I was wondering if it was possible to implement synchronous channels
> within STM. In particular, I'd like to have CSP-like send and recv
> primitives
> on a channel that each block until the other side arrives to complete
>
Hi,
I am trying to compile hmp3. I have the version from darcs at
http://code.haskell.org/~dons/code/hmp3
I am getting the following errors:
Tree.hs:190:14:
No instance for (Binary FilePathP)
arising from a use of `get' at Tree.hs:190:14-16
Possible fix: add an instance declaration fo
Hi,
I have the following definitions
type Zero
type Succ a
so that I can muck around with a Vector type that includes its length
encoded in its type.
I was wondering whether it was possible to use SmallCheck (or
QuickCheck) to generate random Peano numbers? Is there an issue here
in that what I
> If so, you could write a SmallCheck Series instance as follows.
>
> instance Serial (Vec Zero a) where
>series = cons0 nil
>
> instance (Serial a, Serial (Vec n a)) => Serial (Vec (Succ n) a) where
>series = cons2 (|>)
> If we have the property
>
> prop_vector :: Vec (Succ (Succ Zero)
On Fri, Jun 20, 2008 at 3:30 AM, Benedikt Huber <[EMAIL PROTECTED]> wrote:
> Levi Stephen schrieb:
>>
>> Hi,
>>
>> I have the following definitions
>>
>> type Zero
>> type Succ a
>>
>> so that I can muck around with a Vector ty
On Sun, Jul 13, 2008 at 12:31 AM, Roman Leshchinskiy
<[EMAIL PROTECTED]> wrote:
> Hi all,
>
> the vector library will eventually provide fast, Int-indexed arrays with a
> powerful fusion framework. It's very immature at the moment (I haven't
> tested most of the code) and implements just a few co
23 matches
Mail list logo