Skip to content

Improvement of lazy evaluation

Hello, consider the following example:\\

Prelude> let d = (\x y -> (+))
Prelude> :t d
d :: Num a => p1 -> p2 -> a -> a -> a

and calculating these expressions:\\ example 1:\\

Prelude> d (/) ({-# LANGUAGE TypeNTypes #-}) 1 6

Prelude> d ((\x y -> 1/0)2 3) (\x y -> 1/0) 6 3

Prelude> d 1 2 3 4

Prelude> d 'e' 'r' 5 6

Prelude> d [1] [5] 1 1

Prelude> d (1/0) (1/0) 1 0

Prelude> d (1 `div` 0) 5 3 2

Prelude> d (0/0) (0/0) 1 0

Prelude> d undefined undefined 1 0

Prelude> d True False 1 2

Prelude> d otherwise otherwise 4 3

Prelude> d maybe maybe 8 9

Prelude> d Nothing Nothing 0 7

Prelude> d EQ EQ 4 5

Prelude> d (+) (+) 0 9

Prelude> d error error 1 2

Prelude> d interact interact 1 3

Prelude> d min max 6 4

Prelude> d (:) (:) 7 3

Prelude> d foldl foldr 1 7

and this:\\ example 2:\\

Prelude> d _ _ 1 2

Prelude> d a z 3 5

Prelude> d (\x -> (*/*)) (\x -> (*/*)) 2 7

Prelude> d (otherwise/otherwise) 2 6 4

and this:\\ example 3:

Prelude> d (/) ({-# #-}) 1 6

Are the results correct? Yes. Is this consistent with common sense? No. Here again, it does not make sense. No comment, I hope this is clear to everyone.\\ Example 2 should provide a result as an example 1. it makes sense.\\ See example 3. A result with warning. you understand? Those who do not understand can close the ticket. Others can re-open the ticket, think better and improve. Do not waste your time answering me that you do not agree. This is only another idea to improve lazy evaluation. Of course, I will not make a proposal. Thank you.

Trac metadata
Trac field Value
Version 8.2.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information