NicolasT / kontiki

An implementation of the Raft consensus protocol
BSD 3-Clause "New" or "Revised" License
122 stars 15 forks source link

No instance for (Show Builder) in bytestring-0.10.4.0 #4

Closed jkozlowski closed 11 years ago

jkozlowski commented 11 years ago

Compiling against bytestring-0.10.4.0 (which happened to be released when I checked out code and tried to build) is missing Show instance for http://hackage.haskell.org/package/bytestring-0.10.4.0/docs/Data-ByteString-Builder.html.

I am thinking of trying this http://www.haskell.org/cabal/users-guide/developing-packages.html#conditional-compilation over the weekend to fix the build (effectively add conditional compilation). Unless you think that's an overkill?

NicolasT commented 11 years ago

Where does this fail?

jkozlowski commented 11 years ago

Sorry I meant to copy this in, and then I forgot:

src/Network/Kontiki/Types.hs:342:13:
    No instance for (Show Builder)
      arising from the 'deriving' clause of a data type declaration
    Possible fix:
      add an instance declaration for (Show Builder)
      or use a standalone 'deriving instance' declaration,
           so you can specify the instance context yourself
    When deriving the instance for (Show (Command a))
NicolasT commented 11 years ago

Hmm... I guess it makes some sense Builder no longer Has a Show instance, but I'd dislike no longer having a Show instance for Command, mainly for debugging/tracing purposes, which is (I suppose) what you propose?

I'd say a hand-written instance with the CLog value expanded in the result would be more useful?

jkozlowski commented 11 years ago

I agree about the debugging and no Show instance...

I just added the following to silence the compiler:

import Data.ByteString.Builder (toLazyByteString)

instance Show Builder
  where show = show . toLazyByteString
NicolasT commented 11 years ago

That'd introduce an orphan instanc. We really shouldn't have those in any of the Kontiki library modules!

jkozlowski commented 11 years ago

Ouch, gotcha. Still learning

NicolasT commented 11 years ago

No worries :smiley: Not sure how to work around though (except writing tedious instances by hand...)