Simple question.
This compiles:
module Example where
import Network
port :: PortID
port = PortNumber 3001
And this does not:
module Example where
import Network (PortID, PortNumber)
port :: PortID
port = PortNumber 3001
GHC says:
Example.hs:6:8: Not in scope: data constructor `PortNumber'
Why?
It has to be
import Network (PortID(PortNumber))
as PortNumber
seems to be a constructor of PortID
. The other import simply imports all of Network
and hence PortNumber
is found.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With