File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ import Dhall.Syntax
50
50
, Var (.. )
51
51
)
52
52
53
- import Data.Foldable (toList , foldl' )
53
+ import Data.Foldable (toList )
54
54
import Data.Monoid ((<>) )
55
55
import Data.Text (Text )
56
56
import Data.Void (Void , absurd )
@@ -234,15 +234,19 @@ decodeExpressionInternal decodeEmbed = go
234
234
235
235
case tag of
236
236
0 -> do
237
- f <- go
237
+ ! f <- go
238
238
239
- xs <- replicateDecoder (len - 2 ) go
239
+ let loop n ! acc
240
+ | n <= 0 = return acc
241
+ | otherwise = do
242
+ ! x <- go
243
+ loop (n - 1 ) (App acc x)
240
244
241
- if null xs
242
- then die " Non-standard encoding of a function with no arguments"
243
- else return ()
245
+ let nArgs = len - 2
244
246
245
- return (foldl' App f xs)
247
+ if nArgs <= 0
248
+ then die " Non-standard encoding of a function with no arguments"
249
+ else loop nArgs f
246
250
247
251
1 -> do
248
252
case len of
You can’t perform that action at this time.
0 commit comments