fpco / streaming-commons

Common lower-level functions needed by various streaming data libraries
MIT License
36 stars 41 forks source link

Not exported the data constructors of HostPreference #35

Closed yutasth closed 8 years ago

yutasth commented 8 years ago

The function serverSetting in Data.Conduit.Network requires a Data.Streaming.Network.HostPreference as an argument, but thd I had to import

snoyberg commented 8 years ago

It is intended to use the IsString instance, as mentioned in the docs. The constructors are not exposed to allow us to modify the representation in the future.

yutasth commented 8 years ago

but the data constructors are not exported in Data.Streaming.Network. I had to import Data.Streaming.Network.Internal. Is this intended?

snoyberg commented 8 years ago

I'll repeat what I said: you're supposed to use the IsString instance, not the constructors directly. The constructors may change in the future. The docs give examples of doing this, e.g. "*4" means "all IPv4 addresses."

yutasth commented 8 years ago

I import fromString from Data.String and write "serverSetting 80 (fromString "*")" and it works. Thanks for your kindness.

snoyberg commented 8 years ago

You can just turn on the OverloadedStrings language extension, e.g.:

{-# LANGUAGE OverloadedStrings #-}

On Thu, Oct 13, 2016 at 3:17 PM, yutasth notifications@github.com wrote:

I import fromString from Data.String and write "serverSetting 80 (fromString "*")" and it works. Thanks for your kindness.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fpco/streaming-commons/issues/35#issuecomment-253496842, or mute the thread https://github.com/notifications/unsubscribe-auth/AADBB8w1egIJaMkUobeHqojjLfFL-eSPks5qziFygaJpZM4KVz7r .

yutasth commented 8 years ago

I didn't know that extention. Thanks a lot again!