[Haskell] Non-exhaustive pattern in Socket.hsc
Dominic Steinitz
dominic.steinitz at blueyonder.co.uk
Sat Apr 29 08:34:55 EDT 2006
I'm getting
[root at tility pcap]# ./test
test: Socket.hsc:(1434,17)-(1523,20): Non-exhaustive patterns in case
The problem is caused because pcap_findalldevs is returning an address family
value of 17
#define PF_PACKET 17 /* Packet family. */
#define AF_PACKET PF_PACKET
and the ghc Family datatype doesn't support it :-(
data Family
= AF_UNSPEC
| AF_UNIX
| AF_INET
| AF_INET6
| AF_SNA
| AF_DECnet
| AF_APPLETALK
| AF_ROUTE
| AF_X25
| AF_AX25
| AF_IPX
-- Imported from Network.Socket
*Main> map packFamily
[AF_UNSPEC,AF_UNIX,AF_INET,AF_INET6,AF_SNA,AF_DECnet,AF_APPLETALK,AF_ROUTE,AF_X25,AF_AX25,AF_IPX]
[0,1,2,10,22,12,5,16,9,3,4]
I think I have two choices:
1. Amend ghc. I haven't built ghc for a long time. Would I have to build the
whole of ghc? I presume I would have to because of dependencies.
2. Use Network.Alt since
http://www.cs.helsinki.fi/u/ekarttun/network-alt/doc/Network.Alt.Types.html
defines
type Family = Int
Any advice? What is the long term plan for Network anyway?
Thanks, Dominic.
More information about the Haskell
mailing list