Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. weird constraint (Dimitri DeFigueiredo)
2. Re: weird constraint (Sylvain Henry)
3. FFI for PBC - Windows and Nixes (Sumit Raja)
----------------------------------------------------------------------
Message: 1
Date: Wed, 16 Jan 2019 12:52:47 -0200
From: Dimitri DeFigueiredo <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] weird constraint
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
Could someone help me make sense of this Num constraint given by GHCi?
I was expecting to get:
inc . const :: Num a => a -> b -> a
rather than:
inc . const :: Num (b -> a) => a -> b -> a
Here's the transcript:
GHCi, version 8.6.3: http://www.haskell.org/ghc/ :? for help
Prelude> inc x = x + 1
Prelude> :t inc
inc :: Num a => a -> a
Prelude> :t const
const :: a -> b -> a
Prelude> :t inc . const
inc . const :: Num (b -> a) => a -> b -> a
Prelude>
Thanks,
Dimitri
--
2E45 D376 A744 C671 5100 A261 210B 8461 0FB0 CA1F
------------------------------
Message: 2
Date: Wed, 16 Jan 2019 16:05:47 +0100
From: Sylvain Henry <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] weird constraint
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8; format=flowed
Remember that a -> b -> a is equivalent to a -> (b -> a)
So: (forall a. Num a => a -> a) . (a -> (b -> a))
Becomes: (Num (b -> a). (b -> a) -> (b -> a)) . (a -> (b -> a))
Then: Num (b -> a). a -> (b -> a)
Finally: Num (b -> a). a -> b -> a
On 16/01/2019 15:52, Dimitri DeFigueiredo wrote:
> Could someone help me make sense of this Num constraint given by GHCi?
> I was expecting to get:
>
> inc . const :: Num a => a -> b -> a
>
> rather than:
>
> inc . const :: Num (b -> a) => a -> b -> a
>
> Here's the transcript:
>
>
> GHCi, version 8.6.3: http://www.haskell.org/ghc/ :? for help
> Prelude> inc x = x + 1
> Prelude> :t inc
> inc :: Num a => a -> a
> Prelude> :t const
> const :: a -> b -> a
> Prelude> :t inc . const
> inc . const :: Num (b -> a) => a -> b -> a
> Prelude>
>
>
> Thanks,
>
> Dimitri
>
------------------------------
Message: 3
Date: Thu, 17 Jan 2019 20:45:01 +1100
From: Sumit Raja <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] FFI for PBC - Windows and Nixes
Message-ID:
<CAD4nrSdTKs1gTjH5Ro+oVLP=7FPggAyTEw2=xtgdhjwv94y...@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"
Hi,
I am stuck with an odd problem that I don't know how to begin to
resolve. I have developed an FFI wrapper around the PBC library. I
have a number of tests thatcheck simple operations and some of the
more simple examples from the PBC C examples.
On FreeBSD and Linux (Mint) all tests pass successfully but on Windows
(mingw64) many fail with what look like data corruption errors. I
suspect it is something to do with alignment or size calculations but
I have no idea how to proceed.
The hsc file is fairly standard:
data PBCPairing = PBCPairing
data PBCElement = PBCElement
data PBCField = PBCField
data PBCPreProcElement = PBCPreProcElement
instance Storable PBCPairing where
sizeOf _ = #{size struct pairing_s}
alignment _ = #{alignment struct pairing_s}
peek = notImplemented
poke = notImplemented
instance Storable PBCElement where
sizeOf _ = #{size struct element_s}
alignment _ = #{alignment struct element_s}
peek = notImplemented
poke = notImplemented
instance Storable PBCPreProcElement where
sizeOf _ = #{size struct element_pp_s}
alignment _ = #{alignment struct element_pp_s}
peek = notImplemented
poke = notImplemented
instance Storable PBCField where
sizeOf _ = #{size struct field_s}
alignment _ = #{alignment struct field_s}
peek = notImplemented
poke = notImplemented
Generated sizeOf is the same and alignment is 8 across all OSes. I am
using inline-c for the FFI. PBC was built using msys2's version of
mingw64. All the C examples work correctly in the msys2 shell.
Does any one have any ideas on how best to approach this issue?
Thanks
Sumit
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 127, Issue 4
*****************************************