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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:15:36+00:00 2026-06-13T10:15:36+00:00

Consider functions f1 and f2 in for example Haskell or ML. Suppose f2 calls

  • 0

Consider functions f1 and f2 in for example Haskell or ML. Suppose f2 calls f1. Does type inference just use the information of what f1 can call, which amounts to just looking at the definition of f1. Or does it also look at how f2 calls f1 when doing type inference on f1. For example f2 might pass in literals when calling f1 which would restrict the argument types of f1.

  • 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-13T10:15:38+00:00Added an answer on June 13, 2026 at 10:15 am

    Type systems don’t use information about the caller to determine the types a function could handle — that would be both overly restrictive and impossible to achieve in general. E.g., suppose (Haskell)

    aList :: [Int]
    aList = [1,2,3]
    
    one = head aList
    

    would henceforth restrict the type of head from [a] -> a to [Int] -> Int; afterwards, head ["hello", "world"] would be impossible and we’d have to redefine head the next time we want to use it on a different type. However, in the context of the definition of one, head actually has the type [Int] -> Int as the variables in its type get instantiated. But that doesn’t change the global definition of head or its type.

    (In practice, a compiler may specialize a function that it knows is going to be called in only a few situations and adapt the code to the specific types being passed in, as long as it doesn’t change program semantics.)

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

Sidebar

Related Questions

How can I pass anonymous types as parameters to other functions? Consider this example:
for example if we consider document.createElement() function the parameter can be passed in 3
Consider this example of two similar C++ member functions in a class C: void
Consider this example: There is a class named 'first', which is defined in package
I use the following procedure to call the functions within the pages of my
Just to get it straight in my head. Consider this example bit of Erlang
Consider the next example. I have a monad MyM that is just a StateT
How does JavaScript deal with functions with names ending with () ? Consider for
Before Consider to have a class and a global function: This is, for example,
consider the two template functions below: template <typename T, typename A> T* create(A i)

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.