-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ghc-prim is merged with ghc-internal: fix ghc-lib-test-mini-compile
- Loading branch information
1 parent
2f0208c
commit ee1f796
Showing
7 changed files
with
131 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module GHC.Internal.Prim where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
examples/ghc-lib-test-mini-compile/test/MiniCompileTestGhcInternalPrim.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
-- Copyright (c) 2019-2025, Digital Asset (Switzerland) GmbH and/or | ||
-- its affiliates. All rights reserved. SPDX-License-Identifier: | ||
-- (Apache-2.0 OR BSD-3-Clause) | ||
-- Based on | ||
-- https://github.com/ghc/ghc/blob/23f6f31dd66d7c370cb8beec3f1d96a0cb577393/libraries/ghc-prim/GHC/Types.hs | ||
|
||
{-# LANGUAGE NoImplicitPrelude #-} | ||
{-# LANGUAGE MagicHash #-} | ||
|
||
module GHC.Internal.Types ( | ||
-- Data types that are built-in syntax | ||
-- They are defined here, but not explicitly exported | ||
-- | ||
-- Lists: []( [], (::) ) | ||
|
||
Bool(..), Int (..), Word, TextLit, | ||
Ordering(..), | ||
Symbol, | ||
ifThenElse, | ||
Multiplicity(..) | ||
) where | ||
|
||
import GHC.Internal.Prim | ||
|
||
infixr 5 : | ||
|
||
-- | The kind of constraints, like `Show a` | ||
data Constraint | ||
|
||
data Multiplicity = Many | One | ||
|
||
-- | (Kind) This is the kind of type-level symbols. | ||
-- Declared here because class IP needs it | ||
data Symbol | ||
|
||
-- | Documentation for lists | ||
data [] a = [] | a : [a] | ||
|
||
|
||
-- | Information about ordering | ||
data Ordering = LT | EQ | GT | ||
|
||
-- | A 64-bit integer. | ||
data Int = | ||
I# Int# | ||
|
||
-- This is a dummy type we need for string literals. | ||
data Char | ||
|
||
type TextLit = [Char] | ||
|
||
-- A dummy type for Word. | ||
data Word | ||
|
||
data Bool = False | True | ||
|
||
isTrue# :: Int# -> Bool | ||
{-# INLINE isTrue# #-} | ||
isTrue# x = tagToEnum# x | ||
|
||
ifThenElse :: Bool -> a -> a -> a | ||
ifThenElse c t f = case c of True -> t; False -> f | ||
|
||
data Module = Module | ||
TrName -- Package name | ||
TrName -- Module name | ||
|
||
data TrName | ||
= TrNameS Addr# -- Static | ||
| TrNameD [Char] -- Dynamic | ||
|
||
type KindBndr = Int | ||
|
||
data RuntimeRep | ||
|
||
data KindRep = KindRepTyConApp TyCon [KindRep] | ||
| KindRepVar !KindBndr | ||
| KindRepApp KindRep KindRep | ||
| KindRepFun KindRep KindRep | ||
| KindRepTYPE !RuntimeRep | ||
| KindRepTypeLitS TypeLitSort Addr# | ||
| KindRepTypeLitD TypeLitSort [Char] | ||
|
||
data TypeLitSort = TypeLitSymbol | ||
| TypeLitNat | ||
| TypeLitChar | ||
|
||
data TyCon = TyCon Word# Word# -- Fingerprint | ||
Module -- Module in which this is defined | ||
TrName -- Type constructor name | ||
Int# -- How many kind variables do we accept? | ||
KindRep -- A representation of the type's kind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters