Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8266639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:14:05+00:00 2026-06-08T05:14:05+00:00

I created simple project to demonstrate the issue: https://github.com/jdevelop/testcabal If I compile and install

  • 0

I created simple project to demonstrate the issue: https://github.com/jdevelop/testcabal

If I compile and install the module with ‘cabal install’, I can not serialize TestData with Binary:

> ghci                                               
GHCi, version 7.0.4: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
ghci> :m +TestBinary.Test Data.Binary
ghci> randomData  . decode $ encode emptyTest 

<interactive>:1:24:
    No instance for (Binary TTestData)
      arising from a use of `encode'
    Possible fix: add an instance declaration for (Binary TTestData)
    In the second argument of `($)', namely `encode emptyTest'
    In the expression: randomData . decode $ encode emptyTest
    In an equation for `it':
        it = randomData . decode $ encode emptyTest

If I load the Test.hs into ghci directly – everything works as expected,

> ghci TestBinary/Test.hs 
GHCi, version 7.0.4: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
[1 of 1] Compiling TestBinary.Test  ( TestBinary/Test.hs, interpreted )
Ok, modules loaded: TestBinary.Test.
ghci> randomData  . decode $ encode emptyTest 
Loading package array-0.3.0.2 ... linking ... done.
Loading package bytestring-0.9.1.10 ... linking ... done.
Loading package containers-0.4.0.0 ... linking ... done.
Loading package binary-0.5.1.0 ... linking ... done.
"123456"

Version of Haskell compiler:

> ghci --version 
The Glorious Glasgow Haskell Compilation System, version 7.0.4
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T05:14:07+00:00Added an answer on June 8, 2026 at 5:14 am

    In your .cabal file, you have

    Build-depends: base < 5, ghc-binary >= 0.5, bytestring >= 0.9.1
    

    Usually, ghc-binary is not exposed, and it is not intended to be used except by GHC itself. When you load Data.Binary into ghci, it loads the module from the binary package, and the Binary class from that package is a different one than the one from ghc-binary, hence TTestData has no instance.

    If you load the file from source, ghci doesn’t care about the .cabal file and uses the class from binary directly, hence it works.

    You should change the dependency to the binary package.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created a simple .NET MVC project, following the walkthrougth on MSDN.com. I'm confused
I have created a simple project where everyone can create one or more Blog.
So I created a simple project, which I can test as an iPhone app.
i created a simple project with zf and it works fine, but when i
I've created a simple Project model with four attributes: Project name:string description:text complete:boolean user_id:integer
I just created a simple project in VS2010, C# dotnet 3.5 using System; using
We have created a simple wix project for a basic windows application. Everything builds
I created a simple Java EE project in NetBeans (File -> New Project ->
I have created a very simple GUI project in Qt as follows: main: #include
I've created a very simple Enterprise Application project with about 7 entity beans and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.