{-# LANGUAGE TemplateHaskell, KindSignatures, PolyKinds, TypeOperators,
DataKinds, ScopedTypeVariables, TypeFamilies, GADTs,
UndecidableInstances #-}
module Data.Promotion.Prelude.Base (
Foldr, Map, type (++), Otherwise, Id, Const, (:.), type ($), type ($!),
Flip, Until, AsTypeOf, Seq,
FoldrSym0, FoldrSym1, FoldrSym2, FoldrSym3,
MapSym0, MapSym1, MapSym2,
type (++@#@$), type (++@#@$$), type (++@#@$$$),
OtherwiseSym0,
IdSym0, IdSym1,
ConstSym0, ConstSym1, ConstSym2,
type (.@#@$), type (.@#@$$), type (.@#@$$$), type (.@#@$$$$),
type ($@#@$), type ($@#@$$), type ($@#@$$$),
type ($!@#@$), type ($!@#@$$), type ($!@#@$$$),
FlipSym0, FlipSym1, FlipSym2, FlipSym3,
UntilSym0, UntilSym1, UntilSym2, UntilSym3,
AsTypeOfSym0, AsTypeOfSym1, AsTypeOfSym2,
SeqSym0, SeqSym1, SeqSym2
) where
import Data.Singletons.TH
import Data.Singletons.Prelude.Base
$(promoteOnly [d|
until :: (a -> Bool) -> (a -> a) -> a -> a
until p f = go
where
go x | p x = x
| otherwise = go (f x)
|])