Open jwiegley opened 6 years ago
& they should print out the normalized value/expression probably?
A thunk may not ever have a normalized value, since it's acceptable for an attrlist to contain invalid values so long as they are never evaluated.
nix prints <thunk>
while we print "<thunk>"
because we indeed substitute thunk loops (and thunks) by a string before printing. A separate token would allow to keep the information that this is a thunk until we have to print them.
Well. The more I listen to @layus & the more I think about it - the more I agree with @layus, that thunking type system should gain some type abstractions depending on computation done on them.
For me the https://github.com/haskell-nix/hnix/issues/179#issuecomment-865252362 contradicts the https://github.com/haskell-nix/hnix/issues/179#issue-314292570. We need to evaluate the thunks to print them, while they can be infinite & they can contain invalid values or (maybe) even gibberish - which means 1 of 2 things:
Show
instance for thunks should have complex behaviour: depending on the thunk the output mode would differ.<thunk>
.(in other words, it needs to be formulated: current type system state needs to be criticized & different sides in its shortcommings shown) & then develop a solution, establish & thread newtypes into the typesystem, as that is always a first step & preserves all current computation efficiency. Raw thunk
is the base type & the reified stuff builds ontop of it.
As in reality thunks
can not be shown, if it is shown - what is shown is not (no longer a) thunk.
Right now we re-use a lot of code by output thunks as if they were string objects containing the word
"<thunk>"
, but really they should not be display as strings like that.