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

  • Home
  • SEARCH
  • 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 4611538
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:16:53+00:00 2026-05-22T01:16:53+00:00

According to this paper differentiation works on data structures. According to this answer :

  • 0

According to this paper differentiation works on data structures.

According to this answer:

Differentiation, the derivative of a data type D (given as D’) is the type of D-structures with a single “hole”, that is, a distinguished location not containing any data. That amazingly satisfy the same rules as for differentiation in calculus.

The rules are:

 1 = 0
 X′ = 1
 (F + G)′ = F' + G′
 (F • G)′ = F • G′ + F′ • G
 (F ◦ G)′ = (F′ ◦ G) • G′

The referenced paper is a bit too complex for me to get an intuition.
What does this this mean in practice? A concrete example would be fantastic.

  • 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-22T01:16:54+00:00Added an answer on May 22, 2026 at 1:16 am

    What’s a one hole context for an X in an X? There’s no choice: it’s (-), representable by the unit type.

    What’s a one hole context for an X in an X*X? It’s something like (-,x2) or (x1,-), so it’s representable by X+X (or 2*X, if you like).

    What’s a one hole context for an X in an X*X*X? It’s something like (-,x2,x3) or (x1,-,x3) or (x1,x2,-), representable by X*X + X*X + X*X, or (3*X^2, if you like).

    More generally, an F*G with a hole is either an F with a hole and a G intact, or an F intact and a G with a hole.

    Recursive datatypes are often defined as fixpoints of polynomials.

    data Tree = Leaf | Node Tree Tree
    

    is really saying Tree = 1 + Tree*Tree. Differentiating the polynomial tells you the contexts for immediate subtrees: no subtrees in a Leaf; in a Node, it’s either hole on the left, tree on the right, or tree on the left, hole on the right.

    data Tree' = NodeLeft () Tree | NodeRight Tree ()
    

    That’s the polynomial differentiated and rendered as a type. A context for a subtree in a tree is thus a list of those Tree’ steps.

    type TreeCtxt = [Tree']
    type TreeZipper = (Tree, TreeCtxt)
    

    Here, for example, is a function (untried code) which searches a tree for subtrees passing a given test subtree.

    search :: (Tree -> Bool) -> Tree -> [TreeZipper]
    search p t = go (t, []) where
      go :: TreeZipper -> [TreeZipper]
      go z = here z ++ below z
      here :: TreeZipper -> [TreeZipper]
      here z@(t, _) | p t       = [z]
                    | otherwise = []
      below (Leaf,     _)  = []
      below (Node l r, cs) = go (l, NodeLeft () r : cs) ++ go (r, NodeRight l () : cs)
    

    The role of “below” is to generate the inhabitants of Tree’ relevant to the given Tree.

    Differentiation of datatypes is a good way make programs like “search” generic.

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

Sidebar

Related Questions

According to this Haralicks research paper , there are 14 textural features that can
According to this answer , namespace-scoped static variables were undeprecated in C++11. That is,
According to this discussion , the iphone agreement says that it doesn't allow loading
According to this What Techniques Are Best To Live Stream iPhone Video Camera Data
According to this S.O. answer the Firefox Web Developer toolbar has a Save button:
I have a url http://percipi.org/announce?sno=1&lim=1000 . According this data structure I want to display
According this MSDN article HttpApplication .EndRequest can be used to close or dispose of
According to this article Silverlight 2 Beta 2 supports the DataContractJsonSerializer object. But, when
According to this http://perldoc.perl.org/UNIVERSAL.html I shouldn't use UNIVERSAL::isa() and should instead use $obj->isa() or
According to this page, it's possible to use TClientDataset as an in-memory dataset, completely

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.