File: Primitive.hs

package info (click to toggle)
haskell-primitive 0.5.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 124 kB
  • ctags: 5
  • sloc: haskell: 720; ansic: 61; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 894 bytes parent folder | download
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
31
32
33
34
35
36
{-# LANGUAGE MagicHash #-}
{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
-- |
-- Module      : Data.Primitive
-- Copyright   : (c) Roman Leshchinskiy 2009-2012
-- License     : BSD-style
--
-- Maintainer  : Roman Leshchinskiy <rl@cse.unsw.edu.au>
-- Portability : non-portable
-- 
-- Reexports all primitive operations
--
module Data.Primitive (
  module Data.Primitive.Types,
  module Data.Primitive.Array,
  module Data.Primitive.ByteArray,
  module Data.Primitive.Addr,

  sizeOf, alignment
) where

import Data.Primitive.Types
import Data.Primitive.Array
import Data.Primitive.ByteArray
import Data.Primitive.Addr

import GHC.Base ( Int(..) )

-- | Size of values of type @a@. The argument is not used.
sizeOf :: Prim a => a -> Int
sizeOf x = I# (sizeOf# x)

-- | Alignment of values of type @a@. The argument is not used.
alignment :: Prim a => a -> Int
alignment x = I# (alignment# x)