Please,
how to correctly set an explicit type for a local value in the body of
a polymorphic function?
Example (tested under ghc-7.6.1):
data D a = D1 a | D2 a (a -> a)
f :: Eq a => D a -> a
f (D1 x) = x
f (D2 x g) = let -- y :: Eq a => a
y = g x
in
Correction to my last letter:
Run on the second terminal > ./iface
-->
Run on the second terminal > ./a.out
--
Sergei
mech...@botik.ru
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell
People,
can anybody explain what incorrect may happen with the following
program which uses exchange through two Unix pipes and
unsafePerformIO ?
The pipes are created by the Unix commands
mkfifo toA; mkfifo fromA
gcc iface.c compiles the C program to
To my question about safety of
>> toA_IO = openFd "toA" WriteOnly Nothing defaultFileFlags
>> fromA_IO = openFd "fromA" ReadOnly Nothing defaultFileFlags
>> toA = unsafePerformIO toA_IO
>> fromA = unsafePerformIO fromA_IO
>>
>> axiomIO :: String -> IO String
>> axiomIO str = do
>>
On Fri, Jan 13, 2012 at 12:19:34PM -0800, Donn Cave wrote:
> Quoth "Serge D. Mechveliani" ,
> ...
> > Initially, I did the example by the Foreign Function Interface for C.
> > But then, I thought "But this is unnatural! Use plainly the standard
> > Haskell I
On Fri, Jan 13, 2012 at 04:34:37PM +0100, Chadda?? Fouch?? wrote:
> On Thu, Jan 12, 2012 at 7:53 PM, Serge D. Mechveliani
> wrote:
> > [..]
> > I need to organize a string interface for a Haskell function
> > Main.axiom and a C program
> >
On Fri, Jan 13, 2012 at 10:08:04AM -0800, Donn Cave wrote:
> Quoth "Serge D. Mechveliani" ,
> [ ... why in Haskell instead of FFI ... ]
>
> > Because it is a direct and the simplest approach. Why does one need a
> > foreign language, if all the needed functions a
lbery wrote:
>
> > On Fri, Jan 13, 2012 at 12:25, Serge D. Mechveliani wrote:
> >
> >> On Fri, Jan 13, 2012 at 04:34:37PM +0100, Chadda?? Fouch?? wrote:
> >> > Now that seems interesting, but just to be clear : did you choose
> >> > this
I thank people for the notes.
People write that the example without unsafePerformIO is desirable.
So I present the improved question and improved, "pure" code.
--
I need to organize a string interface for a Haskell function
On Fri, Jan 13, 2012 at 04:34:37PM +0100, Chadda?? Fouch?? wrote:
> On Thu, Jan 12, 2012 at 7:53 PM, Serge D. Mechveliani
> wrote:
> > People,
> >
> > (I wonder: is this for beginn...@haskell.org ?)
>
> I don't think so.
>
> >
> > I need to or
People,
(I wonder: is this for beginn...@haskell.org ?)
I need to organize a string interface for a Haskell function
Main.axiom and a C program
fifoFromA.c
via a pair of named pipes (in Linux, UNIX).
The pipes are created before running, by the commands
People,
Here is a certain naive question about string setting in a Haskell
program.
I have the functions
parseProgram :: String -> Program
apply:: Program -> Term -> Term-- interpreter,
and try to build the example modules for them as in the following
example:
---
Consider the following suggestions for the standard Haskell library
`List'.
import List (intersprerse, insertBy)
compose :: [a -> a] -> a -> a -- just appropriate name
compose = foldr (.) id
insertBy2 :: (a -> b) -> Co
Dylan Thurston <[EMAIL PROTECTED]> wrote on 17 Apr 2006
> On Sat, Apr 08, 2006 at 10:16:53PM +0400, Serge D. Mechveliani wrote:
>> I think that without dependent types for a Haskell-like language,
>> it is impossible to propose any adequate and in the same time plainly
On Sat, Apr 08, 2006 at 02:39:39PM +0200, Andrew U. Frank wrote:
> there has been discussions on and off indicating problems with the structure
> of the number classes in the prelude. i have found a discussion paper by
> mechveliani but i have not found a concrete proposal on the haskell' list of
o warning, but variable can still be used.
>
> Keean.
>
> Duncan Coutts wrote:
>
> >In message <[EMAIL PROTECTED]> "Serge D. Mechveliani"
> ><[EMAIL PROTECTED]> writes:
> >
> >
> >>Dear Haskellers, dear GHC team,
> >
To my question of
>> foldlWhile :: (a -> b -> a) -> (a -> Bool) -> a -> [b] -> a
>> foldlWhilefp abs =
>>case
>>(bs, p a)
>>of
>>([],_) -> a
>>(_, False) -> a
>>(b:bs', _) -> foldlWhile f p (f a b) bs'
>>
>> fol
Is such a function familia to the Haskell users?
foldlWhile :: (a -> b -> a) -> (a -> Bool) -> a -> [b] -> a
foldlWhilefp abs =
case
(bs, p a)
of
([],_) -> a
(_, False) -> a
(b:bs', _) -> foldlWhile f p (f a b) b
Dear Haskellers,
I am still trying to find out how to organize naturally a
`lazy' printing of an accumulated data field.
People advised me no-buffering and also the tilde usage.
But there is some more obstackle.
The `trace' is accumulated in fl1 by repeating consD,
where
data D = D {
I thank Jeremy Gibbons, Ben Rudiak-Gould, and other people,
for their helpful explanations.
On Wed, Oct 13, 2004 at 02:34:55PM +0100, Ben Rudiak-Gould wrote:
> Serge D. Mechveliani wrote:
>
> > As the types are resolved before the computation, as the above
> > prog
On Wed, Oct 13, 2004 at 09:23:43AM +0100, MR K P SCHUPKE wrote:
> You can only return a list of pair's lazily, not
> a pair of lists. If the two strings are independant, then
> generate each in a separate function, and pair off the
> results lazily.
No, I have several labeled fields in a record,
On Wed, Oct 13, 2004 at 10:06:44AM +0200, Sander Evers wrote:
>
> >Question 2
> >--
> >How to arrange the above `lazy' output?
> >
> >
> Your function addToSPair
>
> addToSPair :: Char -> (String, String) -> (String, String)
> addToSPairc (xs, ys) = (c:xs, ys)
>
22 matches
Mail list logo