summaryrefslogtreecommitdiff
path: root/testsuite/tests/rebindable/T19167.hs
blob: 4e98e815ea5320f65e533fe5c9831e35196122c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{-# LANGUAGE RebindableSyntax, RankNTypes, TypeApplications, OverloadedStrings,
             OverloadedLists, TypeFamilies #-}

module Bug where

import qualified Prelude as P
import qualified GHC.Exts as P
import Data.List.NonEmpty ( NonEmpty )
import Data.Type.Equality ( type (~) )

fromInteger :: P.Integer -> forall a. P.Num a => a
fromInteger n = P.fromInteger n

shouldBeAnInt = 3 @P.Int

newtype RevString = RevString P.String
  deriving P.Show

instance P.IsString RevString where
  fromString str = RevString (P.reverse str)

fromString :: P.String -> forall a. P.IsString a => a
fromString str = P.fromString str

shouldBeARevString = "hello" @RevString

fromListN :: P.Int -> [elt] -> forall list. (P.IsList list, elt ~ P.Item list) => list
fromListN n l = P.fromListN n l

shouldBeANonEmpty = ['x', 'y', 'z'] @(NonEmpty P.Char)