drops icon indicating copy to clipboard operation
drops copied to clipboard

define type as a cast

Open uhoreg opened this issue 11 months ago • 1 comments

I'd like to device a custom type that uses a cast, but

use Drops.Type, (cast(string(), caster: Caster) |> string())

doesn't seem to work, giving the error:

    The following arguments were given to Drops.Type.infer_constraints/1:

        # 1
        {:cast, {{:type, {:string, []}}, {:type, {:string, []}}, [caster: Caster]}}

    Attempted function clauses (showing 6 out of 6):

        def infer_constraints([])
        def infer_constraints(map) when is_map(map)
        def infer_constraints(type) when is_atom(type)
        def infer_constraints(predicates) when is_list(predicates)
        def infer_constraints({:type, {type, predicates}}) when length(predicates) > 0
        def infer_constraints({:type, {type, []}})

    (drops 0.2.0) lib/drops/type.ex:251: Drops.Type.infer_constraints/1

uhoreg avatar Mar 19 '24 02:03 uhoreg

Same here :) Will be addressed in 0.2.1

solnic avatar Mar 20 '24 23:03 solnic