forked from VinylRecords/Vinyl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Turn ElField into a newtype (VinylRecords#150)
- Loading branch information
Showing
8 changed files
with
85 additions
and
32 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
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,34 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE OverloadedLabels #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# LANGUAGE GADTs #-} | ||
|
||
module Bench.SRec where | ||
|
||
import Data.Vinyl.SRec | ||
import Data.Vinyl | ||
|
||
import Bench.Rec (Fields) | ||
|
||
|
||
mkToSRec :: Int -> SRec ElField Fields | ||
mkToSRec i= toSRec (Field i :& Field i :& Field i :& Field i :& | ||
Field i :& Field i :& Field i :& Field i :& | ||
Field i :& Field i :& Field i :& Field i :& | ||
Field i :& Field i :& Field i :& Field 99 :& | ||
RNil) | ||
|
||
|
||
sumSRec :: SRec ElField Fields -> Int | ||
sumSRec str = | ||
get #a0 str + get #a1 str + get #a2 str + get #a3 str + get #a4 str | ||
+ get #a5 str + get #a6 str + get #a7 str + get #a8 str | ||
+ get #a9 str + get #a10 str + get #a11 str + get #a12 str | ||
+ get #a13 str + get #a14 str + get #a15 str | ||
where | ||
get (label :: Label s) r = | ||
case rget @'(s, Int) r of | ||
Field v -> v | ||
{-# INLINE get #-} |
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