retrie-2.0.0: tests/inputs/Types.test
# Copyright (c) 2025 Andrew Farmer
# Copyright (c) 2020-2024 Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
-l Types.ascribe
-r Types.ascribe
--type-forward Types.Pointless
--type-forward Types.Fn
===
module Types where
{-# RULES "ascribe" forall a b c f x y. (f :: a -> b -> c) x y = f (x :: a) (y :: b) :: c #-}
-main :: IO (Pointless ())
+main :: IO ()
main = do
- print $ (foo :: Int -> String -> Bool) 54 "yolo"
- print $ (bar ("swaggins" :: Text) (True :: Bool) :: Maybe Int)
+ print $ (foo (54 :: Int) ("yolo" :: String) :: Bool)
+ print $ (bar :: Text -> Bool -> Maybe Int) "swaggins" True
type Pointless a = a
type Fn a b = a -> b
data Meh = Meh
- { entryKey :: Pointless (Int -> String)
- , entryVal :: Fn Int String
+ { entryKey :: Int -> String
+ , entryVal :: Int -> String
}
-getKey :: Meh -> Pointless (Int -> String)
+getKey :: Meh -> Int -> String
getKey m x = entryKey m x
-setKey :: Pointless (Int -> String) -> Meh -> Meh
+setKey :: (Int -> String) -> Meh -> Meh
setKey m k = m{ entryKey = k }
-errorKey :: Fn Int String
+errorKey :: Int -> String
errorKey = getKey undefined
-blah :: IO (Fn Int Bool)
+blah :: IO (Int -> Bool)
blah = return (> 0)