You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Description**
The function `Copilot.Core.Type.Uninitialized.uninitialized` was
deprecated in Copilot 3.6. The function was incomplete, and it was only
used in one example, so what was needed from it was moved directly
there.
As per our internal policy of waiting 3 versions from deprecation until
a public interface declaration can be removed, this type can now be
removed completely. Since it is the only definition in the module
`Copilot.Core.Type.Uninitialized`, the whole module can be removed.
**Type**
- Bug: unused code included in the implementation.
**Additional context**
- Issue: #270.
**Requester**
- Ivan Perez
**Method to check presence of bug**
The following expression finds imports of the module `Uninitialized`,
ignoring appearances in comments or strings:
```sh
$ grep -nHre 'Uninitialized' --include='*.hs' | grep -ve '^{-#' | grep -ve '--.*Uninitialized' | grep -ve '"[^"]*Uninitialized[^"]*"'
copilot-core/src/Copilot/Core/Type/Uninitialized.hs:10:module Copilot.Core.Type.Uninitialized
copilot-core/src/Copilot/Core.hs:33: , module Copilot.Core.Type.Uninitialized
copilot-core/src/Copilot/Core.hs:45:import Copilot.Core.Type.Uninitialized
```
We use the module and not the function because a function with the same
name is used in an example.
The result obtained are three lines: the module, its re-import from
`Copilot.Core`, and it being exported. The function `uninitliaized` is
not required by Copilot's requirements, and therefore should not be
published.
A complete dockerfile follows:
```
FROM ubuntu:trusty
RUN apt-get update
RUN apt-get install --yes software-properties-common
RUN add-apt-repository ppa:hvr/ghc
RUN apt-get update
RUN apt-get install --yes ghc-8.6.5 cabal-install-2.4
RUN apt-get install --yes libz-dev
ENV PATH=/opt/ghc/8.6.5/bin:/opt/cabal/2.4/bin:$PWD/.cabal-sandbox/bin:$PATH
RUN cabal update
RUN cabal v1-sandbox init
RUN cabal v1-install alex happy
RUN apt-get install --yes git
CMD git clone $REPO && cd $NAME && git checkout $COMMIT && set -x && grep -nHre '\<Uninitialized\>' --include='*.hs' | grep -ve '^{-#' | grep -ve '--.*Uninitialized' | grep -ve '"[^"]*Uninitialized[^"]*"'
```
It can be executed with:
```
$ docker run -e "REPO=<REPO_URL>" -e "NAME=<DIR>" -e "COMMIT=<TAG_BRANCH_OR_HASH>" -it copilot-verify-302
```
**Expected result**
The string returned by the script should now be empty (module does not
exist).
Running the docker image will show nothing if the module is not present
(the script lists commands being executed):
```
HEAD is now at <TAG_BRANCH_OR_HASH>...<COMMIT_SUMMARY>
+ grep -nHre \<Uninitialized\> --include=*.hs
+ grep -ve ^{-#
+ grep -ve+ "[^"]*Uninitialized[^"]*"
grep -ve --.*Uninitialized
```
**Solution implemented**
The change implementation removes the module
`Copilot.Core.Type.Uninitialized`, as well as its declaration from the
cabal package, and its re-export from `Copilot.Core`.
**Further notes**
See
a72543d
for a confirmation of when the type was deprecated.
0 commit comments