> ## Documentation Index
> Fetch the complete documentation index at: https://docs.canton.network/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> If you are building a Canton Network application, start from https://docs.canton.network/appdev/quickstart.md. To run only a local network for your own Daml code, without building the QuickStart demo, see https://docs.canton.network/sdks-tools/development-tools/localnet.md.

# DA.Stack

> Reference documentation for Daml module DA.Stack.

Daml module

# DA.Stack

\-

Daml

Module
DA.Stack

Latest release
3.7.5

## Data Types

### `data SrcLoc`

Location in the source code.

Line and column are 0-based.

Constructors:

* `SrcLoc`

**srcLocPackage** `Text`

**srcLocModule** `Text`

**srcLocFile** `Text`

**srcLocStartLine** `Int`

**srcLocStartCol** `Int`

**srcLocEndLine** `Int`

**srcLocEndCol** `Int`

Instances:

* instance [`GetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-getfield-53979) `srcLocEndCol` [`SrcLoc`](#type-da-stack-types-srcloc-15887) [`Int`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-int-37261)
* instance [`GetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-getfield-53979) `srcLocEndLine` [`SrcLoc`](#type-da-stack-types-srcloc-15887) [`Int`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-int-37261)
* instance [`GetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-getfield-53979) `srcLocFile` [`SrcLoc`](#type-da-stack-types-srcloc-15887) [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952)
* instance [`GetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-getfield-53979) `srcLocModule` [`SrcLoc`](#type-da-stack-types-srcloc-15887) [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952)
* instance [`GetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-getfield-53979) `srcLocPackage` [`SrcLoc`](#type-da-stack-types-srcloc-15887) [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952)
* instance [`GetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-getfield-53979) `srcLocStartCol` [`SrcLoc`](#type-da-stack-types-srcloc-15887) [`Int`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-int-37261)
* instance [`GetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-getfield-53979) `srcLocStartLine` [`SrcLoc`](#type-da-stack-types-srcloc-15887) [`Int`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-int-37261)
* instance [`SetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-setfield-4311) `srcLocEndCol` [`SrcLoc`](#type-da-stack-types-srcloc-15887) [`Int`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-int-37261)
* instance [`SetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-setfield-4311) `srcLocEndLine` [`SrcLoc`](#type-da-stack-types-srcloc-15887) [`Int`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-int-37261)
* instance [`SetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-setfield-4311) `srcLocFile` [`SrcLoc`](#type-da-stack-types-srcloc-15887) [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952)
* instance [`SetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-setfield-4311) `srcLocModule` [`SrcLoc`](#type-da-stack-types-srcloc-15887) [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952)
* instance [`SetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-setfield-4311) `srcLocPackage` [`SrcLoc`](#type-da-stack-types-srcloc-15887) [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952)
* instance [`SetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-setfield-4311) `srcLocStartCol` [`SrcLoc`](#type-da-stack-types-srcloc-15887) [`Int`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-int-37261)
* instance [`SetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-setfield-4311) `srcLocStartLine` [`SrcLoc`](#type-da-stack-types-srcloc-15887) [`Int`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-int-37261)

### `data CallStack`

Type of callstacks constructed automatically from `HasCallStack` constraints.

Use `callStack` to get the current callstack, and use `getCallStack`
to deconstruct the `CallStack`.

### `type HasCallStack`

\= `IP` `callStack` [`CallStack`](#type-ghc-stack-types-callstack-86244)

Request a `CallStack`. Use this as a constraint in type signatures in order
to get nicer callstacks for error and debug messages.

For example, instead of declaring the following type signature:

```
myFunction : Int -> Update ()
```

You can declare a type signature with the `HasCallStack` constraint:

```
myFunction : HasCallStack => Int -> Update ()
```

The function `myFunction` will still be called the same way, but it will also show up
as an entry in the current callstack, which you can obtain with `callStack`.

Note that only functions with the `HasCallStack` constraint will be added to the
current callstack, and if any function does not have the `HasCallStack` constraint,
the callstack will be reset within that function.

## Functions

### `prettyCallStack`

`prettyCallStack` : [`CallStack`](#type-ghc-stack-types-callstack-86244) -> [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952)

Pretty-print a `CallStack`.

### `getCallStack`

`getCallStack` : [`CallStack`](#type-ghc-stack-types-callstack-86244) -> \[([`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952), [`SrcLoc`](#type-da-stack-types-srcloc-15887))]

Extract the list of call sites from the `CallStack`.

The most recent call comes first.

### `callStack`

`callStack` : [`HasCallStack`](#type-ghc-stack-types-hascallstack-63713) => [`CallStack`](#type-ghc-stack-types-callstack-86244)

Access to the current `CallStack`.
