witchcrafters / algae

Bootstrapped algebraic data types for Elixir
https://hex.pm/packages/algae
MIT License
342 stars 18 forks source link

Compile Error #28

Closed SchrodingerZhu closed 6 years ago

SchrodingerZhu commented 6 years ago

I got a compile error on Windows.

First, there is a long stuck when building witchcraft. PCrEXq.md.png

And then, there is an error.

D:\Code\hello>mix deps.compile algae
==> algae
Compiling 71 files (.ex)
warning: module Witchcraft.Monad.Proto is not a behaviour (in module Witchcraft.Monad.Proto.Algae.State)
  lib/algae/state/monad.ex:3

warning: module Witchcraft.Monad.Proto is not a behaviour (in module Witchcraft.Monad.Proto.Algae.Writer)
  lib/algae/writer/monad.ex:3

warning: The data type Elixir.Algae.State has been forced to skip property validation for the type class Elixir.Witchcraft.Monad

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: module Witchcraft.Monad.Proto is not a behaviour (in module Witchcraft.Monad.Proto.Algae.Id)
  lib/algae/id/monad.ex:2

warning: The data type Elixir.Algae.State has been forced to skip property validation for the type class Elixir.Witchcraft.Applicative

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: function default/1 is unused
  lib/algae/state.ex:79

warning: The data type Elixir.Algae.State has been forced to skip property validation for the type class Elixir.Witchcraft.Apply

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: The data type Elixir.Algae.Reader has been forced to skip property validation for the type class Elixir.Witchcraft.Applicative

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: The data type Elixir.Algae.State has been forced to skip property validation for the type class Elixir.Witchcraft.Chain

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: module Witchcraft.Monad.Proto is not a behaviour (in module Witchcraft.Monad.Proto.Algae.Reader)
  lib/algae/reader/monad.ex:3

warning: module Witchcraft.Monad.Proto is not a behaviour (in module Witchcraft.Monad.Proto.Algae.Tree.BinarySearch.Empty)
  lib/algae/tree/binary_search/monad.ex:4

warning: The data type Elixir.Algae.Reader has been forced to skip property validation for the type class Elixir.Witchcraft.Monad

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: The data type Elixir.Algae.State has been forced to skip property validation for the type class Elixir.Witchcraft.Functor

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: module Witchcraft.Monad.Proto is not a behaviour (in module Witchcraft.Monad.Proto.Algae.Tree.Rose)
  lib/algae/tree/rose/monad.ex:3

warning: module Witchcraft.Monad.Proto is not a behaviour (in module Witchcraft.Monad.Proto.Algae.Free.Pure)
  lib/algae/free/monad.ex:3

warning: variable "type" is unused
  lib/algae.ex:161

warning: this clause cannot match because a previous clause at line 34 always matches
  lib/algae/tree/rose.ex:52

warning: The data type Elixir.Algae.Reader has been forced to skip property validation for the type class Elixir.Witchcraft.Chain

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: variable "ask" does not exist and is being expanded to "ask()", please use parentheses to remove the ambiguity or change the variable name
  lib/algae/reader.ex:130

warning: variable "ask" does not exist and is being expanded to "ask()", please use parentheses to remove the ambiguity or change the variable name
  lib/algae/reader.ex:153

warning: The data type Elixir.Algae.Reader has been forced to skip property validation for the type class Elixir.Witchcraft.Apply

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: this clause cannot match because a previous clause at line 99 always matches
  lib/algae/tree/binary_search.ex:108

warning: this clause cannot match because a previous clause at line 100 always matches
  lib/algae/tree/binary_search.ex:109

== Compilation error in file lib/algae/tree/binary_search/ord.ex ==
** (ExUnit.AssertionError)

Assertion with == failed
code:  assert left == right
left:  :equal
right: :lesser

    lib/ex_unit/assertions.ex:330: ExUnit.Assertions.assert/2
    lib/witchcraft/ord.ex:90: Witchcraft.Ord.Property.transitivity/1
    lib/type_class/property.ex:34: anonymous fn/5 in TypeClass.Property.run!/4
    (elixir) lib/stream.ex:1312: Stream.do_repeatedly/3
    (elixir) lib/enum.ex:2423: Enum.take/2
    lib/algae/tree/binary_search/ord.ex:5: anonymous fn/2 in :elixir_compiler_34.__FILE__/1
    (elixir) lib/enum.ex:1899: Enum."-reduce/3-lists^foldl/2-0-"/3
    lib/algae/tree/binary_search/ord.ex:5: (file)
could not compile dependency :algae, "mix compile" failed. You can recompile this dependency with "mix deps.compile algae", update it with "mix deps.update algae" or clean it with "mix deps.clean algae"

I have tested on erlang 2.1 and erlang 1.9, and the elixir version is 1.6.5 and 1.6.6. PCr43j.md.png

OvermindDL1 commented 6 years ago

There are indeed a lot of warnings when compiling it's dependencies and itself (especially those URL-linked warnings, yeesh ton of those!), but I didn't get an error in compiling itself.

My versions:

Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false]

Interactive Elixir (1.6.1) - press Ctrl+C to exit (type h() ENTER for help)

_/me wonders what this library would look like and how much faster it would be if implemented via my ProtocolEx libraries without structs (proper pattern matching)..._

SchrodingerZhu commented 6 years ago

all elements in my environment have a higher version than @OvermindDL1 's, I suggest that it is the reason?

OvermindDL1 commented 6 years ago

I know the brand-new OTP 21.0 is broken on Windows right now (the just released patch for it fixed it I think though?) but you said you tested 19 as well (assuming 2.1 meant 21 and 1.9 meant 19)? Do you have a fully reproduceable project that you can upload that examples the issue?

SchrodingerZhu commented 6 years ago

@OvermindDL1 In fact, for fare that it is a problem caused by other objects in my project, I reopenned a new one which has the only dep of algae, and it also fails.

OvermindDL1 commented 6 years ago

I reopenned a new one which has the only dep of algae, and it also fails.

Have you updated to the new OTP 21.1 patch yet? Where is a git repo of the example?

SchrodingerZhu commented 6 years ago

Sorry for not being able to reply at once. I am now updating my OTP with version 21.0.1 provided as binary file on the erlang website. And I will upload a git repo for further tests.

SchrodingerZhu commented 6 years ago

https://github.com/SchrodingerZhu/test

SchrodingerZhu commented 6 years ago

Just now, I even compiled elixir from source files(version 1.7.0-dev). And when compiling algae, the output remains the same.

OvermindDL1 commented 6 years ago

I can replicate it! Woo!

@expede:

╰─➤  mix compile                                                                                                   1 ↵
==> algae
Compiling 71 files (.ex)
warning: module Witchcraft.Monad.Proto is not a behaviour (in module Witchcraft.Monad.Proto.Algae.State)
  lib/algae/state/monad.ex:3

warning: The data type Elixir.Algae.State has been forced to skip property validation for the type class Elixir.Witchcraft.Monad

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: module Witchcraft.Monad.Proto is not a behaviour (in module Witchcraft.Monad.Proto.Algae.Writer)
  lib/algae/writer/monad.ex:3

warning: module Witchcraft.Monad.Proto is not a behaviour (in module Witchcraft.Monad.Proto.Algae.Id)
  lib/algae/id/monad.ex:2

warning: function default/1 is unused
  lib/algae/state.ex:79

warning: The data type Elixir.Algae.State has been forced to skip property validation for the type class Elixir.Witchcraft.Applicative

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: The data type Elixir.Algae.State has been forced to skip property validation for the type class Elixir.Witchcraft.Apply

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: The data type Elixir.Algae.Reader has been forced to skip property validation for the type class Elixir.Witchcraft.Applicative

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: The data type Elixir.Algae.State has been forced to skip property validation for the type class Elixir.Witchcraft.Chain

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: module Witchcraft.Monad.Proto is not a behaviour (in module Witchcraft.Monad.Proto.Algae.Tree.BinarySearch.Empty)
  lib/algae/tree/binary_search/monad.ex:4

warning: module Witchcraft.Monad.Proto is not a behaviour (in module Witchcraft.Monad.Proto.Algae.Reader)
  lib/algae/reader/monad.ex:3

warning: The data type Elixir.Algae.Reader has been forced to skip property validation for the type class Elixir.Witchcraft.Monad

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: The data type Elixir.Algae.State has been forced to skip property validation for the type class Elixir.Witchcraft.Functor

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: module Witchcraft.Monad.Proto is not a behaviour (in module Witchcraft.Monad.Proto.Algae.Free.Pure)
  lib/algae/free/monad.ex:3

warning: module Witchcraft.Monad.Proto is not a behaviour (in module Witchcraft.Monad.Proto.Algae.Tree.Rose)
  lib/algae/tree/rose/monad.ex:3

warning: variable "type" is unused
  lib/algae.ex:161

warning: The data type Elixir.Algae.Reader has been forced to skip property validation for the type class Elixir.Witchcraft.Chain

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: this clause cannot match because a previous clause at line 34 always matches
  lib/algae/tree/rose.ex:52

warning: variable "ask" does not exist and is being expanded to "ask()", please use parentheses to remove the ambiguity or change the variable name
  lib/algae/reader.ex:130

warning: variable "ask" does not exist and is being expanded to "ask()", please use parentheses to remove the ambiguity or change the variable name
  lib/algae/reader.ex:153

warning: The data type Elixir.Algae.Reader has been forced to skip property validation for the type class Elixir.Witchcraft.Apply

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: The data type Elixir.Algae.Reader has been forced to skip property validation for the type class Elixir.Witchcraft.Functor

This is sometimes valid, since TypeClass's property checker may not be able to accurately validate all data types correctly for all possible cases. Forcing a type instance in this way is like telling the checker "trust me this is correct", and should only be used as a last resort.

For more, please see the TypeClass README:
https://github.com/expede/type_class/blob/master/README.md

  (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6
  (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3
  (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3
  (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

warning: this clause cannot match because a previous clause at line 99 always matches
  lib/algae/tree/binary_search.ex:108

warning: this clause cannot match because a previous clause at line 100 always matches
  lib/algae/tree/binary_search.ex:109

== Compilation error in file lib/algae/tree/binary_search/ord.ex ==
** (ExUnit.AssertionError) 

Assertion with == failed
code:  assert left == right
left:  :equal
right: :lesser

    lib/ex_unit/assertions.ex:330: ExUnit.Assertions.assert/2
    lib/witchcraft/ord.ex:90: Witchcraft.Ord.Property.transitivity/1
    lib/type_class/property.ex:34: anonymous fn/5 in TypeClass.Property.run!/4
    (elixir) lib/stream.ex:1312: Stream.do_repeatedly/3
    (elixir) lib/enum.ex:2423: Enum.take/2
    lib/algae/tree/binary_search/ord.ex:5: anonymous fn/2 in :elixir_compiler_29.__FILE__/1
    (elixir) lib/enum.ex:1899: Enum."-reduce/3-lists^foldl/2-0-"/3
    lib/algae/tree/binary_search/ord.ex:5: (file)
could not compile dependency :algae, "mix compile" failed. You can recompile this dependency with "mix deps.compile algae", update it with "mix deps.update algae" or clean it with "mix deps.clean algae"
keiSunagawa commented 6 years ago

rewrite dependence version type_class for mix.lock 1.2.x -> 1.2.2

"type_class": {:hex, :type_class, "1.2.2", "a84cab53b80e7c3c15f5ba9a550f5c68646c2b965d19f711f37473803d1ec2ff", [:mix], [{:exceptional, "~> 2.1", [hex: :exceptional, repo: "hexpm", optional: false]}], "hexpm"},

I resolved compile by using this method but doesn't become a solution to the root of the problem.

OvermindDL1 commented 6 years ago

Oh did you lock in an old version? I didn't even check that... >.>

expede commented 6 years ago

Sorry for the delay! I only got an email about this thread now 😖 Weird

TL;DR I know where the issue was introduced (in type_class), and will either fix or patch today.

@OvermindDL1 & @SchrodingerZhu

There are indeed a lot of warnings when compiling it's dependencies and itself (especially those URL-linked warnings, yeesh ton of those!), but I didn't get an error in compiling itself.

Yeah, those are override warnings from TypeClass, and are totally normal. We skip compile-time prop checks on some instances, and it intentionally prints that message warning you that the instance has fewer guarantees about lawfulness. I agree that it's a lot of text, but I'm not sure if this is better or worse than potentially having unprincipled behaviour. I've been considering breaking it out into test helpers instead, which would also speed up the first compilation, but having compile-time checks is a nicety.

First, there is a long stuck when building witchcraft.

This is normal the first time you compile Algae. We're doing a bunch of compile-time property checking (via TypeClass), something that I've been considering removing and creating test generators instead.

Assertion with == failed code: assert left == right left: :equal right: :lesser

Hmm, I was initially getting this exact error when reviewing this PR, but thought that it was fixed 🤔 I'll do some digging, but may just revert that change in type_class.

OvermindDL1 commented 6 years ago

I agree that it's a lot of text, but I'm not sure if this is better or worse than potentially having unprincipled behaviour. I've been considering breaking it out into test helpers instead, which would also speed up the first compilation, but having compile-time checks is a nicety.

I've been thinking about how to handle these similar tests in my ProtocolEx library as well, right now they are always enforced on and ran at compile-time in all modes, but I want to make it configurable, but I cannot really come up with a way that I really like, I might just defer it to a tag-style system environment enable/disable thing... >.>

expede commented 6 years ago

@OvermindDL1

Thinking out loud here, but a potential solution is to add a flag inside the module for when you're happy with an instance, and include a hash of the AST. Now if a single character changes, essentially your cache gets invalidated, and you're forced to retest at compile time 🤔 It might be overkill, I'm not totally sure yet.

OvermindDL1 commented 6 years ago

In my ProtocolEx system (an Elixir Protocol-like library that works on matchers instead of structs and such, significantly more powerful with many chances for optimizations so it generates faster code than Elixir's Protocol's) it supports being able to define property tests (any idea where I got that idea from eh? ;-) ) to ensure the implementations fulfill the requirements of the interface.

I could indeed hash the implementation timestamps and only re-run that when wanted, but it is also designed to be done with actual property testing frameworks like proper or StreamData(sp?) or so, thus it can test different randomized conditions each time, so I'm not sure when it is a good time to stop it. So many variables! o.O!

expede commented 6 years ago
  1. Able to reproduce issue in a new application (not in the libraries themselves for some reason)
  2. Fully diagnosed issue — yep, it's that commit I linked to before in TypeClass
  3. I have a fix that works in my test application, thus confirming the hypothesis
  4. Typing up a postmortem in the hotfix PR right now

Will be merged shortly and pushed to Hex as type_class 1.2.5. @SchrodingerZhu thank you for the bug report! Sorry again for the delay 🙏

expede commented 6 years ago

@SchrodingerZhu I'm going to close this issue. Running mix deps.update type_class should be sufficient (it is in my local tests). Please ping me if you run into further issues!

SchrodingerZhu commented 6 years ago

Thanks for your work!