# How to use NonEmpty within a template

**URL:** <https://forum.canton.network/t/how-to-use-nonempty-within-a-template/4248>\
**Category:** App Development\
**Tags:** daml\
**Created:** [April 4, 2022, 11:10am UTC](https://forum.canton.network/t/how-to-use-nonempty-within-a-template/4248 "2022-04-04T11:10:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cohen.avraham](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@cohen.avraham](https://forum.canton.network/u/cohen.avraham)\
**Post date:** [April 4, 2022, 11:10am UTC](https://forum.canton.network/t/how-to-use-nonempty-within-a-template/4248/1 "2022-04-04T11:10:08Z")

</div>

G-d willing

Hello,  
I want to use the NonEmpty for a list of Decimals within a template, and I can’t find a way in doing so.  
When I am doing it on a regular data type it works okay, as follows:

```haskell
let nums = NE.NonEmpty
          with
            hd = 2
            tl = []

```

But when I am trying to do the same on a template I am getting an error.

```haskell
template NonEmptyTest
  with 
    sideA: Party
    nums: NE.NonEmpty [Int]
  where
    signatory sideA

setup : Script ()
setup = script do

  alice<- allocatePartyWithHint "Alice" (PartyIdHint "Alice")

  submit alice do
    createCmd NonEmptyTest 
      with 
        sideA=alice
        nums= NE.NonEmpty 
          with 
            hd = 2
            tl = []

```

Can you please tell me what am I doing wrong?

---

<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:** [April 4, 2022, 11:59am UTC](https://forum.canton.network/t/how-to-use-nonempty-within-a-template/4248/2 "2022-04-04T11:59:37Z")

</div>

Your template defines `nums` to be a non-empty list of lists of integers. However, you are trying to use it as a non-empty list of integers so without the extra level of lists.

Change the type to `nums : NE.NonEmpty Int` and it should work.
