<p>If you take a look at the <a href="https://github.com/input-output-hk/plutus/blob/master/plutus-tx/src/PlutusTx/IsData/TH.hs#L55" rel="noreferrer">code</a> you can see that <code>makeIsDataIndexed</code> takes 2 arguments (datatype and mapping) but <code>unstableMakeIsData</code> takes only 1 argument, so it's faster to use (that's why it's used in examples)</p>
<p><a href="https://i.sstatic.net/jpliS.png" rel="noreferrer"><img src="https://i.sstatic.net/jpliS.png" alt="enter image description here" /></a></p>
<p>Usage example:</p>
<pre><code>PlutusTx.makeIsDataIndexed ''Action [('Deposit,0),('Choice,1),('Notify,2)]
</code></pre>
<p>With <code>unstableMakeIsData</code> it would look like this:</p>
<pre><code>PlutusTx.unstableMakeIsData ''Action
</code></pre>
<p>You can find more context in this <a href="https://github.com/input-output-hk/plutus/commit/b55b251a30f3238d11c0eede13d31b51d1e745d0" rel="noreferrer">commit</a> as well. Note, that <code>unsafeMakeIsData</code> was later renamed to <code>unstableMakeIsData</code>.</p>
<pre><code>The old `makeIsData` would encode/decode based on the ordering of the
constructors, which isn't stable. We *need* this to be stable across
time, since tools other than our Haskell programs might be producing
datums/redeemers (e.g. CBOR tools in other languages), so we really
don't want this to change unexpectedly.

So we avoid it everywhere. The exception is the usecases: they're just
examples so it's fine for them to be unstable.

Marlowe is probably the most annoying, but I think we *do* care about
the Marlowe types being stable!
</code></pre>

CC BY-SA 4.0
2021-06-16T11:30:34.307Z
Aha, perfect! I didn't see any examples using `makeIsData` so didn't realise it took this extra data. Makes sense now, thank you!
Danny Tuppeny - CODER
CC BY-SA 4.0
2021-06-17T04:16:43.610Z
Great answer, I will award the bounty on Monday just in case somebody can come up with a better answer.  But a better answer seems unlikely. :-)
gRebel
CC BY-SA 4.0
2021-06-16T08:36:37.940Z
2021-06-16T08:50:05.400Z
2021-06-16T08:50:05.400Z
Yanis Urbis
<p>makeIsDataIndexed take 2 values and we use it when we are working with stable data and we don't them to be changing in the future so we index them explicitly to ensure.
Example: makeIsDataIndexed ''Bool [('False,0),('True,1)] so if we refer 1 we will get True and 0 False.</p>
<p>unstableMakeIsData only takes one value and this value won't be changing in the future which mean that there is no need to index it it is only one value.
unstableMakeIsData ''()
Hope it helps</p>

CC BY-SA 4.0
2021-06-16T11:08:03.273Z
2021-06-16T11:14:46.567Z
2021-06-16T11:14:46.567Z
Abkade
<p>In <a href="https://plutus.readthedocs.io/en/latest/plutus/tutorials/basic-validators.html" rel="nofollow noreferrer">the docs about validators</a> a function named <code>unstableMakeIsData</code> is used, but has the following comment:</p>
<pre><code>-- 'unstableMakeIsData' is a TemplateHaskell function that takes a type name and
-- generates an 'IsData' instance definition for it. It should work for most
-- types, including newtypes and sum types. For production usage use 'makeIsDataIndexed'
-- which ensures that the output is stable across time.
unstableMakeIsData ''Date
</code></pre>
<p>It seems inconvenient to have code that needs to be changed for production so I'm curious why this is required. For example, why not just use <code>makeIsDataIndexed</code> in development too? What benefit does <code>unstableMakeIsData</code> have?</p>
<p>I tried searching for both function names across the docs, but the only instances are in two different comments along these same lines.</p>

CC BY-SA 4.0
2021-07-02T23:15:37.590Z
The URL is now broken. 404
ROMANIA_engineer
CC BY-SA 4.0
2021-07-04T08:58:41.300Z
@Elrond_EGLDer I've updated it to what seems to be the same page hosted on another domain. Thanks!
Danny Tuppeny - CODER
<plutus>
What's the difference between `unstableMakeIsData` and `makeIsDataIndexed`?
# What's the difference between `unstableMakeIsData` and `makeIsDataIndexed`?

(Asked by: username_0 on 2021-06-13)

In the docs about validators a function named unstableMakeIsData is used, but has the following comment:
-- 'unstableMakeIsData' is a TemplateHaskell function that takes a type name and
-- generates an 'IsData' instance definition for it. It should work for most
-- types, including newtypes and sum types. For production usage use 'makeIsDataIndexed'
-- which ensures that the output is stable across time.
unstableMakeIsData ''Date

It seems inconvenient to have code that needs to be changed for production so I'm curious why this is required. For example, why not just use makeIsDataIndexed in development too? What benefit does unstableMakeIsData have?
I tried searching for both function names across the docs, but the only instances are in two different comments along these same lines.

**Tags:** plutus
> **Comments:**
> **username_1**: The URL is now broken. 404  
> **username_0**: @Elrond_EGLDer I've updated it to what seems to be the same page hosted on another domain. Thanks!  

---

## 2 answers

### Answer by username_2 on 2021-06-16. Score: 6 | Accepted answer

If you take a look at the code you can see that makeIsDataIndexed takes 2 arguments (datatype and mapping) but unstableMakeIsData takes only 1 argument, so it's faster to use (that's why it's used in examples)

Usage example:
PlutusTx.makeIsDataIndexed ''Action [('Deposit,0),('Choice,1),('Notify,2)]

With unstableMakeIsData it would look like this:
PlutusTx.unstableMakeIsData ''Action

You can find more context in this commit as well. Note, that unsafeMakeIsData was later renamed to unstableMakeIsData.
The old `makeIsData` would encode/decode based on the ordering of the
constructors, which isn't stable. We *need* this to be stable across
time, since tools other than our Haskell programs might be producing
datums/redeemers (e.g. CBOR tools in other languages), so we really
don't want this to change unexpectedly.

So we avoid it everywhere. The exception is the usecases: they're just
examples so it's fine for them to be unstable.

Marlowe is probably the most annoying, but I think we *do* care about
the Marlowe types being stable!

> **Comments:**
> **username_0**: Aha, perfect! I didn't see any examples using `makeIsData` so didn't realise it took this extra data. Makes sense now, thank you!  
> **username_3**: Great answer, I will award the bounty on Monday just in case somebody can come up with a better answer.  But a better answer seems unlikely. :-)  

---

### Answer by username_4 on 2021-06-16. Score: 0

makeIsDataIndexed take 2 values and we use it when we are working with stable data and we don't them to be changing in the future so we index them explicitly to ensure.
Example: makeIsDataIndexed ''Bool [('False,0),('True,1)] so if we refer 1 we will get True and 0 False.

unstableMakeIsData only takes one value and this value won't be changing in the future which mean that there is no need to index it it is only one value.
unstableMakeIsData ''()
Hope it helps


---

