-- | Fixed-point combinator.
--
-- > fix : (a -> a) -> a
-- > fix f = let x = f x in x
e_fix :: Entity
e_fix = Entity "fix" ((a ->> a) ->> a) defaultFixity $
  VFun $ \v -> 
    case v of
      VFun f -> let x = f x in x
      VBottom str -> VBottom str
      _ -> error "Unexpected value, aborting..."

-- | Conditional combinator.
--
-- > if : Bool -> a -> a -> a
-- > if b x y = if b then x else y
e_fix :: Entity
e_fix = Entity "fix" ((a ->> a) ->> a) defaultFixity $
  VFun $ \v -> 
    case v of
      VFun f -> let x = f x in x
      VBottom str -> VBottom str
      _ -> error "Unexpected value, aborting..."

-- | Conditional combinator.
--
-- > if : Bool -> a -> a -> a
-- > if b x y = if b then x else y
e_fix = Entity "fix" ((a ->> a) ->> a) defaultFixity $
  VFun $ \v -> 
    case v of
      VFun f -> let x = f x in x
      VBottom str -> VBottom str
      _ -> error "Unexpected value, aborting..."

-- | Conditional combinator.
--
-- > if : Bool -> a -> a -> a
-- > if b x y = if b then x else y