on efe0be3 help sign in
46 lines 1.5 kB history raw
1-- |
2-- Module : Streamly.Internal.Data.Tuple.Strict
3-- Copyright : (c) 2019 Composewell Technologies
4-- (c) 2013 Gabriel Gonzalez
5-- License : BSD3
6-- Maintainer : streamly@composewell.com
7-- Stability : experimental
8-- Portability : GHC
9--
10-- | Strict data types to be used as accumulator for strict left folds and
11-- scans. For more comprehensive strict data types see
12-- https://hackage.haskell.org/package/strict-base-types . The names have been
13-- suffixed by a prime so that programmers can easily distinguish the strict
14-- versions from the lazy ones.
15--
16-- One major advantage of strict data structures as accumulators in folds and
17-- scans is that it helps the compiler optimize the code much better by
18-- unboxing. In a big tight loop the difference could be huge.
19--
20module Streamly.Internal.Data.Tuple.Strict
21 (
22 Tuple' (..)
23 , Tuple3' (..)
24 -- XXX Remove this type, use a fuse annotation in Tuple3' itself or use a
25 -- custom type where fuse annotation is needed.
26 , Tuple3Fused' (..)
27 , Tuple4' (..)
28 )
29where
31import Fusion.Plugin.Types (Fuse(..))
33-- | A strict '(,)'
34data Tuple' a b = Tuple' !a !b deriving Show
36-- XXX Add TupleFused'
38-- | A strict '(,,)'
39{-# ANN type Tuple3Fused' Fuse #-}
40data Tuple3' a b c = Tuple3' !a !b !c deriving Show
42-- | A strict '(,,)'
43data Tuple3Fused' a b c = Tuple3Fused' !a !b !c deriving Show
45-- | A strict '(,,,)'
46data Tuple4' a b c d = Tuple4' !a !b !c !d deriving Show