hazelgrove / hazel

Hazel, a live functional programming environment with typed holes
http://hazel.org/
MIT License
748 stars 50 forks source link

Update all modules about 'Undefined' #1315

Closed Mars-Cat2023 closed 2 months ago

Mars-Cat2023 commented 3 months ago

Based on the previous two contributors’ (@agrsh and @linsyking) code, I update them on the newest version of Hazel-haz3lcore code but with following few comments:

(1) [Old Problem] Inconsistency of the undefined case in “UExp, UPat, UTPat, UTyp, URul” in TermBase.re and Term.re. [My Change] If I understand correctly, “Undefined” should only be accepted as UExp, not the other four modules, so I don’t adopt the “Undefined in UPat module”. [Frankly speaking, I don’t why they put “Undefined in UPat module”.]

(2) For the documentation of “undefined”, I am not sure about what should I add to ExplainThis.re, ExplainThisForm.re and TerminalExp.re in Haz3lweb/explainthis. What should I do? (Starting with ExplainThis.re Line 545)

(3) Could you give me some suggestions about what should I do for the following cases? [Sorry😭, I forgot the hints you gave last Friday, could you write it down here again?] About Undefined behavior:

<1> Non-determinate cases: Fibonacci (-1) How to detect this behavior before evaluation in complex branching and conditional programs? <2> Unexhaustive cases: match xs with … | | | not exhaustive** I am very unfamiliar with Hazel syntax, so I just tried my best to write one good Hazel example here: ![image](https://github.com/hazelgrove/hazel/assets/153325945/f5e1ef8c-5c23-4121-82d2-d91b2099ddc7) **Any suggestion? Feel free to list below!!!**