# Is there a way to display the "type" of a function or data type in Daml?

**URL:** <https://forum.canton.network/t/is-there-a-way-to-display-the-type-of-a-function-or-data-type-in-daml/3649>\
**Category:** App Development\
**Tags:** daml\
**Created:** [January 4, 2022, 9:55am UTC](https://forum.canton.network/t/is-there-a-way-to-display-the-type-of-a-function-or-data-type-in-daml/3649 "2022-01-04T09:55:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![meet](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/meet/32/198_2.png) [@meet](https://forum.canton.network/u/meet)\
**Post date:** [January 4, 2022, 9:55am UTC](https://forum.canton.network/t/is-there-a-way-to-display-the-type-of-a-function-or-data-type-in-daml/3649/1 "2022-01-04T09:55:29Z")

</div>

Is there a way to display the “type” of a function or data type in Daml - equivalent to `typeof` in JavaScript or `:t functionName` in Haskell?

---

<div class="post-metadata">

**Author:** ![stefanobaghino-da](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/stefanobaghino-da/32/7057_2.png) [@stefanobaghino-da](https://forum.canton.network/u/stefanobaghino-da)\
**Post date:** [January 4, 2022, 9:59am UTC](https://forum.canton.network/t/is-there-a-way-to-display-the-type-of-a-function-or-data-type-in-daml/3649/2 "2022-01-04T09:59:06Z")

</div>

`typeof` in JS and `:t` in Haskell are quite different. Do you mean in Daml Studio, in the REPL, or as some form of runtime reflection?

---

<div class="post-metadata">

**Author:** ![meet](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/meet/32/198_2.png) [@meet](https://forum.canton.network/u/meet)\
**Post date:** [January 4, 2022, 10:32am UTC](https://forum.canton.network/t/is-there-a-way-to-display-the-type-of-a-function-or-data-type-in-daml/3649/3 "2022-01-04T10:32:37Z")

</div>

In Daml Studio, one can already see the type by hovering over the function or data type.  
I’m looking to know if there’s a way to do it in:

1. REPL
2. runtime reflection

---

<div class="post-metadata">

**Author:** ![Luciano](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/luciano/32/319_2.png) [@Luciano](https://forum.canton.network/u/Luciano)\
**Post date:** [January 4, 2022, 10:39am UTC](https://forum.canton.network/t/is-there-a-way-to-display-the-type-of-a-function-or-data-type-in-daml/3649/4 "2022-01-04T10:39:23Z")

</div>

Yes, kind of …

In the repl, you can use holes, as you would in a source file, like so:

```haskell
daml> import DA.Assert ((===))
daml> foldl _ _ ["Hello", "world", "!"] === [(0, "Hello"), (1, "world"), (2, "!")]

```

```shell
File: <string>
Hidden: no
Range: 1:7-1:8
Source: typecheck
Severity: DsError
Message: 
  <string>:1:7: error:
  • Found hole: _ : [(Int, Text)] -> Text -> [(Int, Text)]
  • In the first argument of ‘foldl’, namely ‘_’
  In the first argument of ‘(===)’, namely
  ‘foldl _ _ ["Hello", "world", "!"]’
  In the first argument of ‘show’, namely
  ‘(foldl _ _ ["Hello", "world", "!"]
  === [(0, "Hello"), (1, "world"), (2, "!")])’

```

So you can see in the error message, it tells you the type (after “Found hole”).  
It won’t work in every case, but for functions it does the job.

---

<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:** [January 4, 2022, 12:18pm UTC](https://forum.canton.network/t/is-there-a-way-to-display-the-type-of-a-function-or-data-type-in-daml/3649/5 "2022-01-04T12:18:20Z")

</div>

And just to make this explicit, there is no runtime reflection of types.
