purescript-0.15.15: tests/purs/passing/TCOFloated.purs
module Main where
import Prelude
import Effect.Console (log)
main = log (looper { foo: 100000 })
-- The Ord instance for { foo :: Int } will be floated to an outer scope. This
-- test verifies that TCO happens anyway.
looper :: { foo :: Int } -> String
looper x = if x <= { foo: 0 } then "Done" else looper { foo: x.foo - 1 }