Benjamin Franksen wrote:
On Tuesday 23 May 2006 02:00, Brian Hulley wrote:
I wonder if Haskell' will automatically make type variables scope
over the function body (without an explicit forall)? Is there any
reason why they shouldn't always do so?
One I can think of is that the type signature f
Hello Jacques,
Tuesday, May 23, 2006, 7:13:33 PM, you wrote:
malloc :: Storable a => IO (Ptr a)
malloc = doMalloc undefined
where
doMalloc :: Storable b => b -> IO (Ptr b)
doMalloc dummy = mallocBytes (sizeOf dummy)
>>>Is there any reason to not code this as
>>>
>>
On May 23, 2006, at 11:13 AM, Jacques Carette wrote:
Bertram Felgenhauer wrote:
Jacques Carette wrote:
Bulat Ziganshin wrote:
malloc :: Storable a => IO (Ptr a)
malloc = doMalloc undefined
where
doMalloc :: Storable b => b -> IO (Ptr b)
doMalloc dummy = mallocBytes (sizeOf dumm
Jacques Carette wrote:
> Bulat Ziganshin wrote:
>
> >malloc :: Storable a => IO (Ptr a)
> >malloc = doMalloc undefined
> > where
> > doMalloc :: Storable b => b -> IO (Ptr b)
> > doMalloc dummy = mallocBytes (sizeOf dummy)
> >
> >
> Is there any reason to not code this as
>
> malloc
Jacques Carette wrote:
I guess I prefer a type annotation over a dummy function that is
there just to force the type checker to believe me. If one has to
force the type checker, may as well do it with a type, not code!
I agree totally.
Also, I think there is a more general issue regarding the
Hello Brian,
Tuesday, May 23, 2006, 7:10:23 PM, you wrote:
> Yes. The supreme clevernesss of Bulat's trick is that doMalloc unifies the
my main trick is that i read sources of std libs :)
--
Best regards,
Bulatmailto:[EMAIL PROTECTED]
Bertram Felgenhauer wrote:
Jacques Carette wrote:
Bulat Ziganshin wrote:
malloc :: Storable a => IO (Ptr a)
malloc = doMalloc undefined
where
doMalloc :: Storable b => b -> IO (Ptr b)
doMalloc dummy = mallocBytes (sizeOf dummy)
Is there any reason to not code this
Jacques Carette wrote:
Bulat Ziganshin wrote:
malloc :: Storable a => IO (Ptr a)
malloc = doMalloc undefined
where
doMalloc :: Storable b => b -> IO (Ptr b)
doMalloc dummy = mallocBytes (sizeOf dummy)
Is there any reason to not code this as
malloc :: Storable a => IO (Ptr a)
Jacques Carette wrote:
> Bulat Ziganshin wrote:
>
> >malloc :: Storable a => IO (Ptr a)
> >malloc = doMalloc undefined
> > where
> > doMalloc :: Storable b => b -> IO (Ptr b)
> > doMalloc dummy = mallocBytes (sizeOf dummy)
> >
> >
> Is there any reason to not code this as
>
> malloc
Bulat Ziganshin wrote:
malloc :: Storable a => IO (Ptr a)
malloc = doMalloc undefined
where
doMalloc :: Storable b => b -> IO (Ptr b)
doMalloc dummy = mallocBytes (sizeOf dummy)
Is there any reason to not code this as
malloc :: Storable a => IO (Ptr a)
malloc = mallocBytes $
On Tuesday 23 May 2006 02:00, Brian Hulley wrote:
> I wonder if Haskell' will automatically make type variables scope
> over the function body (without an explicit forall)? Is there any
> reason why they shouldn't always do so?
One I can think of is that the type signature for a function may be at
Hello Brian,
Tuesday, May 23, 2006, 4:05:45 AM, you wrote:
> Thanks for the solutions. The GHC scoped typed variables seem to be the best
> solution since they would seem to be the only way to implement something
> where the type only occurs in the result eg (if the actual fonts were to be
> adde
Cale Gibbard wrote:
Hello,
There's a prelude function called asTypeOf which might help here:
asTypeOf :: a -> a -> a
asTypeOf = const
You can use maxBound `asTypeOf` (fst3 . head $ elements)
Another option is GHC's scoped type variables, which you use by adding
a type signature to your pattern
Chris Kuklewicz wrote:
See "7.4.10.3 Declaration type signatures" in the manual:
http://haskell.org/ghc/docs/6.4.2/html/users_guide/type-extensions.html#decl-type-sigs
At the moment, the "i" in the type declaration and in the body are
not the same "i".
To get the "i" from the type declaration f
Hello,
There's a prelude function called asTypeOf which might help here:
asTypeOf :: a -> a -> a
asTypeOf = const
You can use maxBound `asTypeOf` (fst3 . head $ elements)
Another option is GHC's scoped type variables, which you use by adding
a type signature to your pattern. See:
http://www.has
See "7.4.10.3 Declaration type signatures" in the manual:
http://haskell.org/ghc/docs/6.4.2/html/users_guide/type-extensions.html#decl-type-sigs
At the moment, the "i" in the type declaration and in the body are not the same
"i".
To get the "i" from the type declaration for createMonoMultiFont i
Brian Hulley wrote:
Hi -
I've got the following function which doesn't compile:
createMonoMultiFont
:: (MonadException m, Enum i, Bounded i)
=> [(i, Font, Colour)] -> m (MonoMultiFont i)
createMonoMultiFont elements =
liftIO . block $ do
mmfRaw <- duma_MonoMultiFont_cr
Hi -
I've got the following function which doesn't compile:
createMonoMultiFont
:: (MonadException m, Enum i, Bounded i)
=> [(i, Font, Colour)] -> m (MonoMultiFont i)
createMonoMultiFont elements =
liftIO . block $ do
mmfRaw <- duma_MonoMultiFont_create (fromEnum (maxBo
18 matches
Mail list logo