love-haskell / coercible-utils

Utility functions for Coercible types
https://hackage.haskell.org/package/coercible-utils
BSD 3-Clause "New" or "Revised" License
9 stars 3 forks source link

Add some tests #19

Closed treeowl closed 4 years ago

treeowl commented 4 years ago

Add some inference tests, and start roughing out functionality tests.

treeowl commented 4 years ago

The results of the functionality tests aren't actually checked. Also, there's really no reason to reuse anything between the inference tests and the functionality tests, so it's better not to. That'll allow all of them to be prettier.

chessai commented 4 years ago

The inference test suite pleases me very much.

treeowl commented 4 years ago

In context, there won't be any defaulting. It's belt and suspenders.

On Tue, Jul 30, 2019, 10:18 PM chessai notifications@github.com wrote:

@chessai commented on this pull request.

In test/Spec.hs https://github.com/sjakobi/coercible-utils/pull/19#discussion_r309015342 :

+{-# language PartialTypeSignatures #-} +-- We definitely don't want to infer the types of the test functions +-- based on how they're used; if their implementations and (partial) +-- signatures aren't sufficient, then we don't want them to have +-- Typeable instances. +{-# language NoMonomorphismRestriction #-} +{-# OPTIONS_GHC -Wno-partial-type-signatures #-} + +module Main (main) where +import Data.Monoid (Sum (..), All (..)) +import Control.Newtype.Generic +import Type.Reflection + +-- We don't want defaults making it look like things are working +-- if they're not! +default ()

I believe this prevents GHC from defaulting things to Integer/Float/whatever. See https://wiki.haskell.org/Keywords#default. We don't want any defaulting going on, just in case GHC can't infer the type of something

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sjakobi/coercible-utils/pull/19?email_source=notifications&email_token=AAOOF7ODEM7W3RIVMVMOG6TQCDZAPA5CNFSM4IH77LXKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCACOFHQ#discussion_r309015342, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOOF7LVHMNF2QT4EJ5OWQLQCDZAPANCNFSM4IH77LXA .

sjakobi commented 4 years ago

Thanks David. I've merged this in de3fdd4c7a72ced5e7e5af5fb5b623c5b0a5a562.