# Numeric type defaulting

**URL:** <https://forum.canton.network/t/numeric-type-defaulting/4465>\
**Category:** App Development\
**Created:** [May 2, 2022, 2:36pm UTC](https://forum.canton.network/t/numeric-type-defaulting/4465 "2022-05-02T14:36:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![asarpeshkar](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/asarpeshkar/32/1601_2.png) [@asarpeshkar](https://forum.canton.network/u/asarpeshkar)\
**Post date:** [May 2, 2022, 2:36pm UTC](https://forum.canton.network/t/numeric-type-defaulting/4465/1 "2022-05-02T14:36:39Z")

</div>

Numeric literals with a decimal point are ambiguous since the scale isn’t specified. In most cases I’d like to default to Decimal when applying a polymorphic function to such literals, is there a more concise way then just specializing identity (explicit type annotations are more verbose):

```haskell
dec : Decimal -> Decimal
dec = identity

f (dec 1.1) (dec 2.2)

```

Haskell has default declarations, but those don’t appear to be supported in Daml.

---

<div class="post-metadata">

**Author:** ![Sofia\_Faro](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/sofia_faro/32/168_2.png) [@Sofia\_Faro](https://forum.canton.network/u/Sofia_Faro)\
**Post date:** [May 3, 2022, 12:08pm UTC](https://forum.canton.network/t/numeric-type-defaulting/4465/2 "2022-05-03T12:08:25Z")

</div>

Hi @asarpeshkar,

Daml doesn’t support defaulting for numeric literals. The approach you showed is a good one. The more common solution is to use type annotations (which are a bit more verbose, like you said):

```haskell
f (1.1 : Decimal) (2.2 : Decimal)

```

We don’t have defaults in daml because we don’t want daml developers to accidentally use the wrong level of precision & start getting unexpected results. In practice the lack of defaults isn’t a big issue because the type checker can infer the precision in a lot of cases (like when you used `dec` here, for example). In cases where the type checker can’t infer it, you do need to supply the precision via a type annotation.
