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 7438349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:32:28+00:00 2026-05-29T10:32:28+00:00

I have been writing a growing code base in Haskell. My problem is that

  • 0

I have been writing a growing code base in Haskell. My problem is that I have added type signatures to functions based on what GHCI tells me they should be.

The problem is now that I have a growing codebase, as soon as I change one thing, my code breaks all over the place and I am consumed with tracking down all of the problems.

Are the types derived by loading a module in ghci too specific? How do I decide which type or type classes to use in my signatures to leverage the power of strong typing with some flexibility? (i.e. not spending an hour propagating minor changes?).

  • 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-05-29T10:32:28+00:00Added an answer on May 29, 2026 at 10:32 am

    The problem is now that I have a growing codebase, as soon as I change one thing, my code breaks all over the place and I am consumed with tracking down all of the problems.

    This is actually advertised as a feature in Yesod (a Haskell web framework). Suppose I have specified the following routing specification:

    /blog/#String         BlogR   GET
    

    And I decide I want to change it to

    /blog/#Date/#String   BlogR   GET
    

    As soon as I make this change to the routes, the compiler will tell me everywhere that I have broken my code. I will be forced to update the getBlogR function – changing its input type so it also accepts a Date. I will also be forced to update any place where I use type safe URLs in my templates, which would look something like @{BlogR (slug p)} -> @{BlogR (date p) (slug p)}.

    This is considered a Good Thing, because the type checker is helping you to find problems introduced by the changes you made.


    Now, regarding ghci.

    ghci> let shew = show
    ghci> :t shew
    shew :: () -> String
    ghci> :t show
    show :: Show a => a -> String
    

    It is sometimes true that ghci chooses annoying defaults. This, however, can be alleviated.

    ghci> :set -XNoMonomorphismRestriction
    ghci> let shew = show
    ghci> :t shew
    shew :: Show a => a -> String
    

    While using ghci to discover the type of a function is great for beginners, I wouldn’t recommend relying on ghci. Learn what the type signatures mean, and how to discover them yourself. In fact, start writing a function by first writing the type signature you intend it to have. It only takes a small investment of time to learn this skill, and it is a great boon to programming when you can use Haskell’s type system to your advantage.

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

Sidebar

Related Questions

I have been writing some code that creates a generic blog. Its features are
I have been writing some code that detects add and removal of USB devices,
I have been writing unit tests using NUnit and Moq with my Silverlight code
I have been writing Python code for only a couple of weeks, so I'm
I have been writing DLL on C++, that will be use in C#. DLL
I have been experimenting with writing applications that use a local SQL Database to
I have been writing an assembly to simplify much of my POCO type generation.
I have been writing several class templates that contain nested iterator classes, for which
I have been writing some C# code for a training exercise, in which I
I have been writing same code for insert, update, delete with LINQ over 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.