Movatterモバイル変換
[0]ホーム
{-# LANGUAGE Unsafe #-}{-# LANGUAGE MagicHash, UnboxedTuples, TypeFamilies, DeriveDataTypeable, MultiParamTypeClasses, FlexibleInstances, NoImplicitPrelude #-}------------------------------------------------------------------------------- |-- Module : GHC.Exts-- Copyright : (c) The University of Glasgow 2002-- License : see libraries/base/LICENSE---- Maintainer : cvs-ghc@haskell.org-- Stability : internal-- Portability : non-portable (GHC Extensions)---- GHC Extensions: this is the Approved Way to get at GHC-specific extensions.---- Note: no other base module should import this module.-----------------------------------------------------------------------------moduleGHC.Exts(-- * Representations of some basic typesInt(..),Word(..),Float(..),Double(..),Char(..),Ptr(..),FunPtr(..),-- * The maximum tuple sizemaxTupleSize,-- * Primitive operationsmoduleGHC.Prim,shiftL#,shiftRL#,iShiftL#,iShiftRA#,iShiftRL#,uncheckedShiftL64#,uncheckedShiftRL64#,uncheckedIShiftL64#,uncheckedIShiftRA64#,isTrue#,-- * Fusionbuild,augment,-- * Overloaded string literalsIsString(..),-- * Debuggingbreakpoint,breakpointCond,-- * Ids with special behaviourlazy,inline,oneShot,-- * Running 'RealWorld' state transformersrunRW#,-- * Safe coercions---- | These are available from the /Trustworthy/ module "Data.Coerce" as well---- @since 4.7.0.0Data.Coerce.coerce,Data.Coerce.Coercible,-- * Equalitytype(~~),-- * Representation polymorphismGHC.Prim.TYPE,RuntimeRep(..),VecCount(..),VecElem(..),-- * Transform comprehensionsDown(..),groupWith,sortWith,the,-- * Event loggingtraceEvent,-- * SpecConstr annotationsSpecConstrAnnotation(..),-- * The call stackcurrentCallStack,-- * The Constraint kindConstraint,-- * The Any typeAny,-- * Overloaded listsIsList(..))whereimportGHC.Primhiding(coerce,TYPE)importqualifiedGHC.PrimimportGHC.Basehiding(coerce)importGHC.WordimportGHC.IntimportGHC.PtrimportGHC.StackimportqualifiedData.CoerceimportData.StringimportData.OldListimportData.DataimportData.OrdimportData.Version(Version(..),makeVersion)importqualifiedDebug.Trace-- XXX This should really be in Data.Tuple, where the definitions aremaxTupleSize::IntmaxTupleSize=62-- | 'the' ensures that all the elements of the list are identical-- and then returns that unique elementthe::Eqa=>[a]->athe(x:xs)|all(x==)xs=x|otherwise=errorWithoutStackTrace"GHC.Exts.the: non-identical elements"the[]=errorWithoutStackTrace"GHC.Exts.the: empty list"-- | The 'sortWith' function sorts a list of elements using the-- user supplied function to project something out of each elementsortWith::Ordb=>(a->b)->[a]->[a]sortWithf=sortBy(\xy->compare(fx)(fy))-- | The 'groupWith' function uses the user supplied function which-- projects an element out of every list element in order to first sort the-- input list and then to form groups by equality on these projected elements{-# INLINEgroupWith#-}groupWith::Ordb=>(a->b)->[a]->[[a]]groupWithfxs=build(\cn->groupByFBcn(\xy->fx==fy)(sortWithfxs)){-# INLINE[0]groupByFB#-}-- See Note [Inline FB functions] in GHC.ListgroupByFB::([a]->lst->lst)->lst->(a->a->Bool)->[a]->lstgroupByFBcneqxs0=groupByFBCorexs0wheregroupByFBCore[]=ngroupByFBCore(x:xs)=c(x:ys)(groupByFBCorezs)where(ys,zs)=span(eqx)xs-- ------------------------------------------------------------------------------- tracingtraceEvent::String->IO()traceEvent=Debug.Trace.traceEventIO{-# DEPRECATEDtraceEvent"Use 'Debug.Trace.traceEvent' or 'Debug.Trace.traceEventIO'"#-}-- deprecated in 7.4{- *********************************************************************** ** SpecConstr annotation ** *********************************************************************** -}-- Annotating a type with NoSpecConstr will make SpecConstr-- not specialise for arguments of that type.-- This data type is defined here, rather than in the SpecConstr module-- itself, so that importing it doesn't force stupidly linking the-- entire ghc package at runtimedataSpecConstrAnnotation=NoSpecConstr|ForceSpecConstrderiving(Data-- ^ @since 4.3.0.0,Eq-- ^ @since 4.3.0.0){- *********************************************************************** ** The IsList class ** *********************************************************************** -}-- | The 'IsList' class and its methods are intended to be used in-- conjunction with the OverloadedLists extension.---- @since 4.7.0.0classIsListlwhere-- | The 'Item' type function returns the type of items of the structure-- @l@.typeIteml-- | The 'fromList' function constructs the structure @l@ from the given-- list of @Item l@fromList::[Iteml]->l-- | The 'fromListN' function takes the input list's length as a hint. Its-- behaviour should be equivalent to 'fromList'. The hint can be used to-- construct the structure @l@ more efficiently compared to 'fromList'. If-- the given hint does not equal to the input list's length the behaviour of-- 'fromListN' is not specified.fromListN::Int->[Iteml]->lfromListN_=fromList-- | The 'toList' function extracts a list of @Item l@ from the structure @l@.-- It should satisfy fromList . toList = id.toList::l->[Iteml]-- | @since 4.7.0.0instanceIsList[a]wheretype(Item[a])=afromList=idtoList=id-- | @since 4.9.0.0instanceIsList(NonEmptya)wheretypeItem(NonEmptya)=afromList(a:as)=a:|asfromList[]=errorWithoutStackTrace"NonEmpty.fromList: empty list"toList~(a:|as)=a:as-- | @since 4.8.0.0instanceIsListVersionwheretype(ItemVersion)=IntfromList=makeVersiontoList=versionBranch-- | Be aware that 'fromList . toList = id' only for unfrozen 'CallStack's,-- since 'toList' removes frozenness information.---- @since 4.9.0.0instanceIsListCallStackwheretype(ItemCallStack)=(String,SrcLoc)fromList=fromCallSiteListtoList=getCallStack
[8]ページ先頭