From ade38c607a8d0dc8dc1d701084ed88df2fa89df9 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Tue, 26 Nov 2024 23:05:30 +0100 Subject: Working argument accum mode (...) The derivative of 'neural' in full accum mode is pretty atrocious now; I think this is because when you have code like this: \(a :: Arr 1 R) -> let b = a in let c = b in sum d then because the argument, as well as both let bindings, bind a value of array type, each will introduce an accumulator, hence resulting in three (!) nested `with` clauses that each just contribute their result back to their parent. This is pointless, and we should fix this. --- src/Interpreter/Rep.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Interpreter/Rep.hs') diff --git a/src/Interpreter/Rep.hs b/src/Interpreter/Rep.hs index 0007991..335ad1f 100644 --- a/src/Interpreter/Rep.hs +++ b/src/Interpreter/Rep.hs @@ -37,7 +37,7 @@ type family RepAcSparse t where -- Immutable, and does not necessarily have a zero. type family RepAcDense t where RepAcDense TNil = () - -- RepAcDense (TPair a b) = (RepAcSparse a, RepAcSparse b) + RepAcDense (TPair a b) = (RepAcSparse a, RepAcSparse b) RepAcDense (TEither a b) = Either (RepAcSparse a) (RepAcSparse b) -- RepAcDense (TMaybe t) = RepAcSparse (TMaybe t) -- ^ This can be optimised to TMaybe (RepAcSparse t), but that makes accumAddDense very hard to write. And in any case, we don't need it because D2 will not produce Maybe of Maybe. -- RepAcDense (TArr n t) = Array n (RepAcSparse t) -- cgit v1.2.3-70-g09d2