Type Error Slicing
What is a type error and how do you locate one?
Christian Haack Joe Wells DePaul University Heriot-Watt University
fpl.cs.depaul.edu/chaack www.macs.hw.ac.uk/˜jbw
Type Error Slicing – p.1/38
Type Error Slicing What is a type error and how do you locate one? - - PowerPoint PPT Presentation
Type Error Slicing What is a type error and how do you locate one? Christian Haack Joe Wells DePaul University Heriot-Watt University fpl.cs.depaul.edu/chaack www.macs.hw.ac.uk/jbw Type Error Slicing p.1/38 Overview Concepts.
Christian Haack Joe Wells DePaul University Heriot-Watt University
fpl.cs.depaul.edu/chaack www.macs.hw.ac.uk/˜jbw
Type Error Slicing – p.1/38
Concepts. Examples. Algorithms. Completeness and Minimality. Conclusion.
Type Error Slicing – p.2/38
Type Error Slicing – p.3/38
Type Error Slicing – p.3/38
Type Error Slicing – p.3/38
Type Error Slicing – p.3/38
Type Error Slicing – p.4/38
Type Error Slicing – p.4/38
Type Error Slicing – p.4/38
Type Error Slicing – p.4/38
Type Error Slicing – p.5/38
Type Error Slicing – p.5/38
Type Error Slicing – p.5/38
Type Error Slicing – p.5/38
Type Error Slicing – p.5/38
Concepts. Examples. Algorithms. Completeness and Minimality. Conclusion.
Type Error Slicing – p.6/38
let val iterator = fn (x,(sum,length)) => (sum + weight x , length+1) val (sum,length) = foldl iterator (0,0) list in sum div length end
let val average = average weight val iterator = fn (list,(best,max)) => let val avg_list = average list in if avg_list > max then (list,avg_list) else (best,max) end val (best,_) = foldl iterator (nil,0) lists in best end
Type Error Slicing – p.7/38
let val iterator = fn (x,(sum,length)) => (sum + weight x , length+1) val (sum,length) = foldl iterator (0,0) list in sum div length end
let val average = average weight val iterator = fn (list,(best,max)) => let val avg_list = average list in if avg_list > max then (list,avg_list) else (best,max) end val (best,_) = foldl iterator (nil,0) lists in best end
Type Error Slicing – p.8/38
let val iterator = fn (x,(sum,length)) => (sum + weight x , length+1) val (sum,length) = foldl iterator (0,0) list in sum div length end
let val average = average weight val iterator = fn (list,(best,max)) => let val avg_list = average list in if avg_list > max then (list,avg_list) else (best,max) end val (best,_) = foldl iterator (nil,0) lists in best end
Type Error Slicing – p.9/38
let val iterator = fn (x,(sum,length)) => (sum + weight x , length+1) val (sum,length) = foldl iterator (0,0) list in sum div length end
let val average = average weight val iterator = fn (list,(best,max)) => let val avg_list = average list in if avg_list > max then (list,avg_list) else (best,max) end val (best,_) = foldl iterator (nil,0) lists in best end
Type Error Slicing – p.10/38
Type Error Slicing – p.11/38
Type Error Slicing – p.12/38
Type Error Slicing – p.13/38
Type Error Slicing – p.14/38
let val iterator’ = fn (x,(list,state)) => let val (x,state) = iterator (x,state) in (list @ x, state) end in foldl iterator’ (nil,state) list end
let val iterator = fn (n,inc) => if isEven n then ( n , inc ) else ( 2 * n , inc + n ) in mapActL iterator (list,0) end
Type Error Slicing – p.15/38
let val iterator’ = fn (x,(list,state)) => let val (x,state) = iterator (x,state) in (list @ x, state) end in foldl iterator’ (nil,state) list end
let val iterator = fn (n,inc) => if isEven n then ( n , inc ) else ( 2 * n , inc + n ) in mapActL iterator (list,0) end
Type Error Slicing – p.16/38
let val iterator’ = fn (x,(list,state)) => let val (x,state) = iterator (x,state) in (list @ x, state) end in foldl iterator’ (nil,state) list end
let val iterator = fn (n,inc) => if isEven n then ( n , inc ) else ( 2 * n , inc + n ) in mapActL iterator (list,0) end
Type Error Slicing – p.17/38
Type Error Slicing – p.18/38
Type Error Slicing – p.19/38
Type Error Slicing – p.20/38
Type Error Slicing – p.21/38
Type Error Slicing – p.21/38
Type Error Slicing – p.21/38
Concepts. Examples. Algorithms. Step 1: Associate a set of type constraints with each program point. Step 2: Find minimal unsolvable sets of constraints. Step 3: Compute slice representations. Completeness and Minimality. Conclusion.
Type Error Slicing – p.22/38
Type Error Slicing – p.23/38
Type Error Slicing – p.23/38
Type Error Slicing – p.23/38
Type Error Slicing – p.23/38
l
Type Error Slicing – p.24/38
l
Type Error Slicing – p.24/38
Type Error Slicing – p.25/38
Type Error Slicing – p.25/38
Type Error Slicing – p.25/38
Type Error Slicing – p.25/38
l
Type Error Slicing – p.25/38
l
k
Type Error Slicing – p.25/38
Concepts. Examples. Algorithms. Step 1: Associate a set of type constraints with each program point. Step 2: Find minimal unsolvable sets of constraints. Step 3: Compute slice representations. Completeness and Minimality. Conclusion.
Type Error Slicing – p.26/38
Type Error Slicing – p.27/38
Type Error Slicing – p.27/38
Type Error Slicing – p.27/38
Type Error Slicing – p.27/38
Type Error Slicing – p.27/38
Type Error Slicing – p.28/38
Type Error Slicing – p.28/38
Type Error Slicing – p.28/38
Type Error Slicing – p.28/38
Type Error Slicing – p.29/38
Type Error Slicing – p.29/38
Type Error Slicing – p.29/38
Type Error Slicing – p.29/38
Concepts. Examples. Algorithms. Step 1: Associate a set of type constraints with each program point. Step 2: Find minimal unsolvable sets of constraints. Step 3: Compute slice representations. Completeness and Minimality. Conclusion.
Type Error Slicing – p.30/38
Type Error Slicing – p.31/38
Type Error Slicing – p.31/38
Type Error Slicing – p.31/38
Type Error Slicing – p.31/38
Type Error Slicing – p.32/38
Concepts. Examples. Algorithms. Completeness and Minimality. Conclusion.
Type Error Slicing – p.33/38
Type Error Slicing – p.34/38
Type Error Slicing – p.34/38
Type Error Slicing – p.35/38
Type Error Slicing – p.35/38
Type Error Slicing – p.35/38
Concepts. Examples. Algorithms. Completeness and Minimality. Conclusion.
Type Error Slicing – p.36/38
Type Error Slicing – p.37/38
Type Error Slicing – p.37/38
Type Error Slicing – p.37/38
Type Error Slicing – p.37/38
Type Error Slicing – p.37/38
Type Error Slicing – p.38/38
Type Error Slicing – p.38/38
Type Error Slicing – p.38/38
Type Error Slicing – p.39/38
Type Error Slicing – p.39/38
Type Error Slicing – p.39/38
Type Error Slicing – p.39/38
Type Error Slicing – p.39/38
Type Error Slicing – p.39/38
Type Error Slicing – p.39/38
Type Error Slicing – p.39/38
Type Error Slicing – p.39/38