Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/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. Re: unix-2.6.0.1 fails to build on the current haskell
platform on the mac (Kim-Ee Yeoh)
2. Re: unix-2.6.0.1 fails to build on the current haskell
platform on the mac (Miguel Negrao)
3. Re: System.USB.writeInterrupt -- confused by error message
from type system (David McBride)
4. Re: System.USB.writeInterrupt -- confused by error message
from type system (emacstheviking)
----------------------------------------------------------------------
Message: 1
Date: Wed, 27 Feb 2013 16:44:15 +0000
From: Kim-Ee Yeoh <[email protected]>
Subject: Re: [Haskell-beginners] unix-2.6.0.1 fails to build on the
current haskell platform on the mac
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<CAPY+ZdQJDPWy2t9h55oD9G=7-Ud37Dz8McPayWavQH=v9sm...@mail.gmail.com>
Content-Type: text/plain; charset="windows-1252"
Did you try the workaround by lukexi mentioned in the ticket?
-- Kim-Ee
On Wed, Feb 27, 2013 at 10:35 AM, Miguel Negrao <
[email protected]> wrote:
> Hi
>
> I?m trying to install iCalendar which depends on some package which
> depends on unix-2.6.0.1. unix-2.6.0.1 does not build on the mac with ghc
> 7.4. The issue has been reported at
> http://hackage.haskell.org/trac/ghc/ticket/7359, but I don?t think it?s
> fixed yet. It appears unix-2.6.0.1 works fine with ghc 7.6.1 but the
> current haskell platform comes with 7.4. What are my options ? Should I
> install ghc 7.6 ? If I do that what else do I have to install/update to
> make everything functional again ?
>
> best,
> Miguel
> http://www.friendlyvirus.org/miguelnegrao/
>
>
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130227/720c508f/attachment-0001.htm>
------------------------------
Message: 2
Date: Wed, 27 Feb 2013 17:49:35 +0000
From: Miguel Negrao <[email protected]>
Subject: Re: [Haskell-beginners] unix-2.6.0.1 fails to build on the
current haskell platform on the mac
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=windows-1252
A 27/02/2013, ?s 16:44, Kim-Ee Yeoh escreveu:
> Did you try the workaround by lukexi mentioned in the ticket?
>
> -- Kim-Ee
Overlooked that. Did the substitution and now it works fine. Thanks !
Miguel
------------------------------
Message: 3
Date: Wed, 27 Feb 2013 14:21:20 -0500
From: David McBride <[email protected]>
Subject: Re: [Haskell-beginners] System.USB.writeInterrupt -- confused
by error message from type system
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<can+tr42fdjywn8nwowtuxv2vkvou4cfjkrfvb87tknn8jcm...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
You have this line in your code, but that doesn't correlate to the imports
you listed.
BS.replicate 64 '\0'
import qualified Data.ByteString as B ( ByteString,
packCStringLen, drop, length )
import qualified Data.ByteString.Internal as BI ( createAndTrim,
createAndTrim' )
import qualified Data.ByteString.Unsafe as BU ( unsafeUseAsCStringLen
)
So you must have imported Data.ByteString.Lazy as BS somewhere. Change
that to B.replicate and it will probably work.
On Wed, Feb 27, 2013 at 11:41 AM, emacstheviking <[email protected]> wrote:
> Karol, Alexander,
>
> Thanks for your feedback... I am still a little confused as I shall
> explain... first of all let's look at the prototype for 'writeInterrupt',
>
>
> writeInterrupt :: DeviceHandle -> EndpointAddress -> WriteAction
>
> To me, that reads a "takes a device handle and an endpoint address and
> returns a WriteAction", and to quote the WriteAction help text verbatim so
> there is no confusion:
>
> type WriteAction = ByteString -> Timeout -> IO (Size, Status)Source
>
> Handy type synonym for write transfers.
>
> "A WriteAction is a function which takes a ByteString to write and
> a Timeout.
> The function returns an IO action which, when exectued(sic),
> returns the number
> of bytes that were actually written paired with a Status flag
> which indicates whether
> the transfer Completed or TimedOut."
>
>
> Now let's move to my original code and the 'right' code...
>
> action <- writeInterrupt handle endPoint
> let action = writeInterrupt handle endPoint
>
>
> If I understand things correctly up to this point, my mistake was being
> too eager in using "<-", my mind at that point was obviously confusing the
> return value from WriteAction with the return type of writeInterrupt and I
> can see now that what I should have done was use "let" which captures the
> WriteAction that is returned which can be executed with the payload and the
> timeout on the next line:
>
> (size, status) <- action payload 1000
>
> On this line, the use of "<-" is what is required in order to cause the
> promised IO action to perform its duties and return me the tuple of data
> sent and status returned from the USB inner workings.
>
> However, we now come to the new type checker error, and this one has me
> floored right now. Time and time again I find myself beating my head
> against a wall and tearing my hair out trying to understand the
> thousand-and-one variations on strings in Haskell! I even tried the
> "string-conversions" (convertString) package but decided to battle it out
> instead...
>
> First the new code as edited in response to Karol:
>
>
> testBoard :: Device -> DeviceHandle -> IO ()
> testBoard dev handle = do
>
> putStrLn $ "Inspecting device: \"" ++ (show dev) ++ "\""
> -- write 0x00 0x00 0x00 0x00, get back same...we need to pad
> the
> -- packet out to 64 bytes for a full-speed device... should
> probably
> -- get this (64) from the device configuration / description
> record
> -- for maximum
> portability!
>
> let payload = BS.replicate 64 '\0'
>
> let endPoint = EndpointAddress 0 Out
> let action = writeInterrupt handle endPoint
> (size, status) <- action payload 1000
> return ()
>
> And the new error:
>
> usb1.hs:64:28:
> Couldn't match expected type
> `bytestring-0.9.2.1:Data.ByteString.Internal.ByteString'
> with actual type `ByteString'
> In the first argument of `action', namely `payload'
> In a stmt of a 'do' block: (size, status) <- action payload 1000
>
> In the expression:
> do { putStrLn $ "Inspecting device: \"" ++ (show dev) ++ "\"";
> let payload = BS.replicate 64 '\NUL';
> let endPoint = EndpointAddress 0 Out;
> let action = writeInterrupt handle endPoint;
> .... }
>
>
> Where and why does it think that "Data.ByteString.Internal.ByteString" is
> the type of the first parameter to "action" which is quite clearly stated
> as being "ByteString" ???
> I know that "String", the native type is 4-bytes and that ByteString
> (Strict) and ByteString (Lazy) are both 8-bit, which is great, and I
> understand that the strict version (at least to me) feels like the
> rightmatch to be using for data buffers for a USB transfer but why oh why
> oh why can't I understand why the type checker picked up "internal"
> somewhere along the way?
>
> In the source code for WriteAction we have this:
>
> type WriteAction = B.ByteString ? Timeout ? IO (Size, Status)
>
> and at the top of the that source file:
>
> -- from bytestring:
> import qualified Data.ByteString as B ( ByteString,
> packCStringLen, drop, length )
> import qualified Data.ByteString.Internal as BI ( createAndTrim,
> createAndTrim' )
> import qualified Data.ByteString.Unsafe as BU (
> unsafeUseAsCStringLen )
>
>
> So why is it trying to be "internal"! I have tried not to be lazy, I have
> read everything and looked everywhere before posting again. If it had said:
>
> type WriteAction = BI.ByteString ? Timeout ? IO (Size, Status)
>
> I would have understood but it doesn't does it ?!
> Can somebody explain for me so I can just get on and write my killer USB
> application please! LOL
>
> :)
> Thanks,
> Sean.
>
>
>
>
>
> On 27 February 2013 12:07, Karol Samborski <[email protected]> wrote:
>
>> Hi Sean,
>>
>> I think that your function for testing board should look like this:
>>
>> testBoard :: Device -> DeviceHandle -> IO ()
>> testBoard dev handle = do
>> putStrLn $ "Inspecting device: \"" ++ (show dev) ++ "\"\n"
>> -- write 0x00 0x00 0x00 0x00, get back same...
>> let payload = pack "\x00\x00\x00\x00"
>> let endPoint = EndpointAddress 0 Out
>> let action = writeInterrupt handle endPoint
>> (size, status) <- action payload 1000
>> return ()
>>
>> You need to use let because writeInterrupt returns (Timeout ->
>> ByteString -> IO (Size, Bool)) instead of IO (Timeout -> ByteString ->
>> IO (Size, Bool))
>>
>> Karol
>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130227/e10949dd/attachment-0001.htm>
------------------------------
Message: 4
Date: Wed, 27 Feb 2013 20:38:41 +0000
From: emacstheviking <[email protected]>
Subject: Re: [Haskell-beginners] System.USB.writeInterrupt -- confused
by error message from type system
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<caeieuujquceeokvb3xdbml6sk2j+pdmcvc9emvhkkkunwxl...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
David, maybe my code got chopped then because this is the start of my
program:
module Main where
import Data.ByteString.Char8 as BS hiding (putStrLn) ***HERE IT IS***
import Data.String.Conversions as SC
import Data.Word (Word16)
import Data.Vector as V (filterM, null, (!)) --as V hiding ((++))
import System.USB
import System.Environment
where the "BS" (pardon the pun) is quite plainly defined. And changing it
as suggested only yields this:
usb1.hs:61:18:
Not in scope: `B.replicate'
Perhaps you meant `BS.replicate' (imported from Data.ByteString.Char8)
So I don't think that's the solution.
>From digging around it seems that I might have in fact got a broken set of
libraries. I found this:
http://stackoverflow.com/questions/12576817/couldnt-match-expected-type-with-actual-type-error-when-using-codec-bmp
and
when I actually listed the bytestring packages as suggested I get this
(terrible!) output:
WARNING: there are broken packages. Run 'ghc-pkg check' for more
details.
/var/lib/ghc/package.conf.d
bytestring-0.9.2.1
/home/sean/.ghc/i386-linux-7.4.2/package.conf.d
bytestring-0.10.0.1
and doing the suggested "ghc-pkg check" made me reach for the toilet
rolls....
WARNING: there are broken packages. Run 'ghc-pkg check' for more details.
/var/lib/ghc/package.conf.d
bytestring-0.9.2.1
/home/sean/.ghc/i386-linux-7.4.2/package.conf.d
bytestring-0.10.0.1
sean@sean-Dimension-4700 ~/Documents/haskell/usb $ ghc-pkg check
There are problems in package snap-core-0.9.3.1:
dependency "vector-0.10.0.1-fdf8e0c3f3c1cae1113ab97c34aa5c14" doesn't
exist
There are problems in package tls-extra-0.6.1:
dependency "vector-0.10.0.1-fdf8e0c3f3c1cae1113ab97c34aa5c14" doesn't
exist
There are problems in package crypto-numbers-0.1.3:
dependency "vector-0.10.0.1-fdf8e0c3f3c1cae1113ab97c34aa5c14" doesn't
exist
There are problems in package repa-io-3.2.2.201204.1:
dependency "vector-0.10.0.1-fdf8e0c3f3c1cae1113ab97c34aa5c14" doesn't
exist
There are problems in package repa-algorithms-3.2.2.201204.1:
dependency "vector-0.10.0.1-fdf8e0c3f3c1cae1113ab97c34aa5c14" doesn't
exist
There are problems in package repa-3.2.2.201204.1:
dependency "vector-0.10.0.1-fdf8e0c3f3c1cae1113ab97c34aa5c14" doesn't
exist
There are problems in package vty-4.7.0.20:
dependency "vector-0.10.0.1-fdf8e0c3f3c1cae1113ab97c34aa5c14" doesn't
exist
There are problems in package pango-0.12.2:
dependency "cairo-0.12.3-89ddba0b76b80ddab58fabdf2a845c76" doesn't exist
There are problems in package webkit-0.12.3:
dependency "cairo-0.12.3-89ddba0b76b80ddab58fabdf2a845c76" doesn't exist
There are problems in package gtk-0.12.3:
dependency "cairo-0.12.3-89ddba0b76b80ddab58fabdf2a845c76" doesn't exist
The following packages are broken, either because they have a problem
listed above, or because they depend on a broken package.
snap-core-0.9.3.1
tls-extra-0.6.1
crypto-numbers-0.1.3
repa-io-3.2.2.201204.1
repa-algorithms-3.2.2.201204.1
repa-3.2.2.201204.1
vty-4.7.0.20
pango-0.12.2
webkit-0.12.3
gtk-0.12.3
hakyll-4.1.4.0
snap-server-0.9.3.1
http-conduit-1.8.7.1
tls-1.1.2
crypto-pubkey-0.1.2
gloss-raster-1.7.7.201204.1
yi-0.6.6.0
hbro-0.9.0.0
hbro-contrib-0.9.0.0
ltk-0.12.0.0
So... I think that my real problem is that I have a badly broken package
setup. I am going to remove both bytestring packages as well as all those
broken things (I don't need them anyway( and reinstall and see what
happens. I hope it just goes away.... I really want to be USB programming
not fixing up my installation.. nothing like computers to make life awkward.
Thanks.
Sean.
On 27 February 2013 19:21, David McBride <[email protected]> wrote:
> You have this line in your code, but that doesn't correlate to the imports
> you listed.
>
> BS.replicate 64 '\0'
>
> import qualified Data.ByteString as B ( ByteString,
> packCStringLen, drop, length )
> import qualified Data.ByteString.Internal as BI ( createAndTrim,
> createAndTrim' )
> import qualified Data.ByteString.Unsafe as BU (
> unsafeUseAsCStringLen )
>
> So you must have imported Data.ByteString.Lazy as BS somewhere. Change
> that to B.replicate and it will probably work.
>
>
> On Wed, Feb 27, 2013 at 11:41 AM, emacstheviking <[email protected]>wrote:
>
>> Karol, Alexander,
>>
>> Thanks for your feedback... I am still a little confused as I shall
>> explain... first of all let's look at the prototype for 'writeInterrupt',
>>
>>
>> writeInterrupt :: DeviceHandle -> EndpointAddress -> WriteAction
>>
>> To me, that reads a "takes a device handle and an endpoint address and
>> returns a WriteAction", and to quote the WriteAction help text verbatim so
>> there is no confusion:
>>
>> type WriteAction = ByteString -> Timeout -> IO (Size, Status)Source
>>
>> Handy type synonym for write transfers.
>>
>> "A WriteAction is a function which takes a ByteString to write
>> and a Timeout.
>> The function returns an IO action which, when exectued(sic),
>> returns the number
>> of bytes that were actually written paired with a Status flag
>> which indicates whether
>> the transfer Completed or TimedOut."
>>
>>
>> Now let's move to my original code and the 'right' code...
>>
>> action <- writeInterrupt handle endPoint
>> let action = writeInterrupt handle endPoint
>>
>>
>> If I understand things correctly up to this point, my mistake was being
>> too eager in using "<-", my mind at that point was obviously confusing the
>> return value from WriteAction with the return type of writeInterrupt and I
>> can see now that what I should have done was use "let" which captures the
>> WriteAction that is returned which can be executed with the payload and the
>> timeout on the next line:
>>
>> (size, status) <- action payload 1000
>>
>> On this line, the use of "<-" is what is required in order to cause the
>> promised IO action to perform its duties and return me the tuple of data
>> sent and status returned from the USB inner workings.
>>
>> However, we now come to the new type checker error, and this one has me
>> floored right now. Time and time again I find myself beating my head
>> against a wall and tearing my hair out trying to understand the
>> thousand-and-one variations on strings in Haskell! I even tried the
>> "string-conversions" (convertString) package but decided to battle it out
>> instead...
>>
>> First the new code as edited in response to Karol:
>>
>>
>> testBoard :: Device -> DeviceHandle -> IO ()
>> testBoard dev handle = do
>>
>> putStrLn $ "Inspecting device: \"" ++ (show dev) ++ "\""
>> -- write 0x00 0x00 0x00 0x00, get back same...we need to pad
>> the
>> -- packet out to 64 bytes for a full-speed device... should
>> probably
>> -- get this (64) from the device configuration / description
>> record
>> -- for maximum
>> portability!
>>
>> let payload = BS.replicate 64 '\0'
>>
>> let endPoint = EndpointAddress 0 Out
>> let action = writeInterrupt handle endPoint
>> (size, status) <- action payload 1000
>> return ()
>>
>> And the new error:
>>
>> usb1.hs:64:28:
>> Couldn't match expected type
>> `bytestring-0.9.2.1:Data.ByteString.Internal.ByteString'
>> with actual type `ByteString'
>> In the first argument of `action', namely `payload'
>> In a stmt of a 'do' block: (size, status) <- action payload 1000
>>
>> In the expression:
>> do { putStrLn $ "Inspecting device: \"" ++ (show dev) ++ "\"";
>> let payload = BS.replicate 64 '\NUL';
>> let endPoint = EndpointAddress 0 Out;
>> let action = writeInterrupt handle endPoint;
>> .... }
>>
>>
>> Where and why does it think that "Data.ByteString.Internal.ByteString" is
>> the type of the first parameter to "action" which is quite clearly stated
>> as being "ByteString" ???
>> I know that "String", the native type is 4-bytes and that ByteString
>> (Strict) and ByteString (Lazy) are both 8-bit, which is great, and I
>> understand that the strict version (at least to me) feels like the
>> rightmatch to be using for data buffers for a USB transfer but why oh why
>> oh why can't I understand why the type checker picked up "internal"
>> somewhere along the way?
>>
>> In the source code for WriteAction we have this:
>>
>> type WriteAction = B.ByteString ? Timeout ? IO (Size, Status)
>>
>> and at the top of the that source file:
>>
>> -- from bytestring:
>> import qualified Data.ByteString as B ( ByteString,
>> packCStringLen, drop, length )
>> import qualified Data.ByteString.Internal as BI ( createAndTrim,
>> createAndTrim' )
>> import qualified Data.ByteString.Unsafe as BU (
>> unsafeUseAsCStringLen )
>>
>>
>> So why is it trying to be "internal"! I have tried not to be lazy, I have
>> read everything and looked everywhere before posting again. If it had said:
>>
>> type WriteAction = BI.ByteString ? Timeout ? IO (Size, Status)
>>
>> I would have understood but it doesn't does it ?!
>> Can somebody explain for me so I can just get on and write my killer USB
>> application please! LOL
>>
>> :)
>> Thanks,
>> Sean.
>>
>>
>>
>>
>>
>> On 27 February 2013 12:07, Karol Samborski <[email protected]> wrote:
>>
>>> Hi Sean,
>>>
>>> I think that your function for testing board should look like this:
>>>
>>> testBoard :: Device -> DeviceHandle -> IO ()
>>> testBoard dev handle = do
>>> putStrLn $ "Inspecting device: \"" ++ (show dev) ++ "\"\n"
>>> -- write 0x00 0x00 0x00 0x00, get back same...
>>> let payload = pack "\x00\x00\x00\x00"
>>> let endPoint = EndpointAddress 0 Out
>>> let action = writeInterrupt handle endPoint
>>> (size, status) <- action payload 1000
>>> return ()
>>>
>>> You need to use let because writeInterrupt returns (Timeout ->
>>> ByteString -> IO (Size, Bool)) instead of IO (Timeout -> ByteString ->
>>> IO (Size, Bool))
>>>
>>> Karol
>>>
>>> _______________________________________________
>>> Beginners mailing list
>>> [email protected]
>>> http://www.haskell.org/mailman/listinfo/beginners
>>>
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130227/7f98fc99/attachment.htm>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 56, Issue 44
*****************************************