-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
127 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,4 +267,4 @@ patToExp = \case | |
_ -> Nothing | ||
|
||
data Strictness = Lazy | Strict | ||
deriving Show | ||
deriving (Eq, Show) |
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,35 @@ | ||
module Inlining where | ||
|
||
open import Haskell.Prelude | ||
|
||
record Wrap (a : Set) : Set where | ||
constructor Wrapped | ||
field | ||
unwrap : a | ||
open Wrap public | ||
{-# COMPILE AGDA2HS Wrap unboxed #-} | ||
|
||
mapWrap : (f : a → b) → Wrap a → Wrap b | ||
mapWrap f (Wrapped x) = Wrapped (f x) | ||
{-# COMPILE AGDA2HS mapWrap inline #-} | ||
|
||
mapWrap2 : (f : a → b → c) → Wrap a → Wrap b → Wrap c | ||
mapWrap2 f (Wrapped x) (Wrapped y) = Wrapped (f x y) | ||
{-# COMPILE AGDA2HS mapWrap2 inline #-} | ||
|
||
test1 : Wrap Int → Wrap Int | ||
test1 x = mapWrap (1 +_) x | ||
{-# COMPILE AGDA2HS test1 #-} | ||
|
||
test2 : Wrap Int → Wrap Int → Wrap Int | ||
test2 x y = mapWrap2 _+_ x y | ||
{-# COMPILE AGDA2HS test2 #-} | ||
|
||
-- partial application of inline function | ||
test3 : Wrap Int → Wrap Int → Wrap Int | ||
test3 x = mapWrap2 _+_ x | ||
{-# COMPILE AGDA2HS test3 #-} | ||
|
||
test4 : Wrap Int → Wrap Int → Wrap Int | ||
test4 = mapWrap2 _+_ | ||
{-# COMPILE AGDA2HS test4 #-} |
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 |
---|---|---|
|
@@ -61,4 +61,5 @@ import Issue210 | |
import ModuleParameters | ||
import ModuleParametersImports | ||
import Coerce | ||
import Inlining | ||
|
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,14 @@ | ||
module Inlining where | ||
|
||
test1 :: Int -> Int | ||
test1 x = 1 + x | ||
|
||
test2 :: Int -> Int -> Int | ||
test2 x y = x + y | ||
|
||
test3 :: Int -> Int -> Int | ||
test3 x = \ y -> x + y | ||
|
||
test4 :: Int -> Int -> Int | ||
test4 = \ x y -> x + y | ||
|