# Using has\_type(list(Type), X) with user created type not working as expected

**URL:** <https://swi-prolog.discourse.group/t/using-has-type-list-type-x-with-user-created-type-not-working-as-expected/1340>\
**Category:** Help!\
**Created:** [October 1, 2019, 5:38pm UTC](https://swi-prolog.discourse.group/t/using-has-type-list-type-x-with-user-created-type-not-working-as-expected/1340 "2019-10-01T17:38:25Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![pmoura](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/pmoura/32/11_2.png) [@pmoura](https://swi-prolog.discourse.group/u/pmoura)\
**Post date:** [October 2, 2019, 9:41am UTC](https://swi-prolog.discourse.group/t/using-has-type-list-type-x-with-user-created-type-not-working-as-expected/1340/4 "2019-10-02T09:41:44Z")

</div>

Note on the example code. This clause:

> [@EricGT](#):
>
> ```prolog
> key_value_validate(Key_value) :-
> must_be(ground,Key_value),
> Key_value = kv(Key,Value),
> must_be(ground,Key),
> must_be(ground,Value).
> 
> ```

can be simplified to:

```prolog
key_value_validate(Key_value) :-
    must_be(ground,Key_value),
    Key_value = kv(_,_).

```

If `Key_value` is ground, then necessarily `Key` and `Value` are also ground.

---

_[View the full topic](https://swi-prolog.discourse.group/t/using-has-type-list-type-x-with-user-created-type-not-working-as-expected/1340)._
