# Inlining Daml code

**URL:** <https://forum.canton.network/t/inlining-daml-code/5630>\
**Category:** App Development\
**Tags:** daml\
**Created:** [November 9, 2022, 10:16pm UTC](https://forum.canton.network/t/inlining-daml-code/5630 "2022-11-09T22:16:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leonid\_Rozenberg](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/leonid_rozenberg/32/48_2.png) [@Leonid\_Rozenberg](https://forum.canton.network/u/Leonid_Rozenberg)\
**Post date:** [November 9, 2022, 10:16pm UTC](https://forum.canton.network/t/inlining-daml-code/5630/1 "2022-11-09T22:16:09Z")

</div>

Asking for a friend, does Daml’s GHC portion respect the [INLINE](https://wiki.haskell.org/Inlining_and_Specialisation#What_does_the_INLINE_pragma_do.3F) pragma? Ex.

```haskell
lift : Action m => m a -> ContT r m a
lift m = ContT (m >>=)
{-# INLINE lift #-}

```

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [November 10, 2022, 8:50am UTC](https://forum.canton.network/t/inlining-daml-code/5630/2 "2022-11-10T08:50:37Z")

</div>

No it does not. There is very limited inlining for typeclass methods that are statically known but generally my recommendation is that you assume the Daml compiler does not optimizations on your code at all and what is being run is what you write.

---

<div class="post-metadata">

**Author:** ![Leonid\_Rozenberg](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/leonid_rozenberg/32/48_2.png) [@Leonid\_Rozenberg](https://forum.canton.network/u/Leonid_Rozenberg)\
**Post date:** [November 10, 2022, 2:40pm UTC](https://forum.canton.network/t/inlining-daml-code/5630/3 "2022-11-10T14:40:11Z")

</div>

![709amm](https://canada1.discourse-cdn.com/flex028/uploads/daml/original/2X/a/abe308eb1f93cc67731701d0439728c0eb3f36f7.jpeg)

Obviously, you’re Batman, I’m Robin.

---

<div class="post-metadata">

**Author:** ![bernhard](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/bernhard/32/356_2.png) [@bernhard](https://forum.canton.network/u/bernhard)\
**Post date:** [November 10, 2022, 3:05pm UTC](https://forum.canton.network/t/inlining-daml-code/5630/4 "2022-11-10T15:05:05Z")

</div>

I wouldn’t worry about optimising the CPU time of Daml interpretation too much. In the grand scheme of things, that does not tend to be the bottleneck unless your algorithmic complexity is out of whack.

---

<div class="post-metadata">

**Author:** ![Leonid\_Rozenberg](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/leonid_rozenberg/32/48_2.png) [@Leonid\_Rozenberg](https://forum.canton.network/u/Leonid_Rozenberg)\
**Post date:** [November 10, 2022, 3:20pm UTC](https://forum.canton.network/t/inlining-daml-code/5630/5 "2022-11-10T15:20:10Z")

</div>

![709hpu](https://canada1.discourse-cdn.com/flex028/uploads/daml/original/2X/9/9a7d939881a7660d7d512bcff948104936e733a5.jpeg)

Bernhard’s Batman … I’m still Robin
